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_init_local warning suppression: local variable not initialized http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 #pragma W_INIT_LOCAL Warning suppression: Local variable not initialized
------------------------------------------------------------------------------
 Syntax
   #pragma W_INIT_LOCAL+|-

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

 Description
   The #pragma W_INIT_LOCAL directive controls the generation
   of a compiler warning when a local variable is used in an expression
   without prior initialization. Because local variables do not automatically
   contain a default value after declaration, their indefinite value
   may cause unpredictable results, unless they are properly initialized
   before use.

 Example
   #define EXAMPLE_DIRECTIV
   #include example.hdr

   proc Test_869
   vardef
      uint   uNum
      _HFILE hFile
   enddef
   
   #pragma W_INIT_LOCAL+ // warning is issued
   ? istr( uNum )        // program bug: prints accidental value
   
   // suppress warnings for variables that are initialized by the library
   #pragma W_INIT_LOCAL-
   if fbopen( hFile, "c:\autoexec.bat", FB_READ )
      fbclose( hFile )
   endif
   endproc

   proc main
   Test_869()
   endproc

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