The value of sRESULT may be, or is, undefined at the end of the Macro

Navigation:  Messages > Macro Compiler Messages > Warnings >

The value of sRESULT may be, or is, undefined at the end of the Macro

Previous pageReturn to chapter overviewNext page

This compiler warning is generated if it is possible for the value of sRESULT to be undefined at the end of a macro. In the example below, sResult is undefined if the function HolidayOfListOnDate returns false.

 

var

begin

  if HolidayOfListOnDate('a', n_TokenDate)

       sRESULT = EvalToken(n_TokenDate, s_TokenRoot)

  endif

end

 

Usually this type of warning occurs using branching without specifying what happens in the else case. There are 2 way to address this warning, using the above example :

 

var

begin

   bRESULT = HolidayOfListOnDate('a', n_TokenDate)

  if HolidayOfListOnDate('a', n_TokenDate)

                 sRESULT = EvalToken(n_TokenDate, s_TokenRoot)

  else

                 sRESULT = ''

  endif

end

 

or alternatively

 

var

begin

 sRESULT = ''

  if HolidayOfListOnDate('a', n_TokenDate)

      sRESULT = EvalToken(n_TokenDate, s_TokenRoot)

  endif

end

 

Note that you should also include an else statement in switch statements.


Topic 110123 updated on 11-Apr-2002.
Topic URL: http://www.qppstudio.net/webhelp/index.html?thevalueofsresultmaybe_oris_un.htm