Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Force 4.0 Reference - #pragma w_expr_local warning suppression: local variable in expression http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 #pragma W_EXPR_LOCAL Warning suppression: Local variable in expression
------------------------------------------------------------------------------
 Syntax
   #pragma W_EXPR_LOCAL+|-

 Arguments
   + and - control if the option is on or off, respectively.

 Description
   The #pragma W_EXPR_LOCAL directive controls the generation
   of a compiler warning when a local variable is used in an expression
   associated with the locate, set filter to, and set relation to commands.

   Because local variables only have a scope within the function or
   procedure they are declared in, a continue command (or any other
   command which moves the record pointer) issued outside the function or
   procedure will fail, because the variable, required to evaluate the
   necessary locate, filter, or relation expression is no longer in
   scope.

 Example
   #define EXAMPLE_DIRECTIV
   #include example.hdr

   dbfdef sTest
      char( 15 ) name
   enddef
   
   proc Test_864
   vardef
      char( 15 ) cName
   enddef
   cName := "Cathy"
   build "stest.dbf" from alias sTest
   open sTest
   append blank
   sTest->name := cName
   #pragma W_EXPR_LOCAL+
   set filter to trim( sTest->name ) == cName // warning is issued
   
   #pragma W_EXPR_LOCAL-
   set filter to trim( sTest->name ) == cName // no warning for this line
   
   locate for sTest->name = cName
   ? found()
   close all
   erase "stest.dbf"
   endproc

   proc main
   Test_864()
   endproc

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson