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 - #ifdef conditional compilation start (defined identifier) http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 #ifdef              Conditional compilation start (defined identifier)
------------------------------------------------------------------------------
 Syntax
   #ifdef <macroname>
      <statements>
   #else
      <statements>
   #endif

 Arguments
   <macroname> is a macro identifier.
   <statements> are source instructions for the compiler.

 Description
   The #ifdef directive starts a conditional compilation block.
   It controls whether or not the section of code between the #ifdef
   directive and the #endif directive is compiled.

   If the macro identifier has been defined, then the statements between
   the #ifdef and the #endif (or the #else, if there is one) will be
   compiled. If there is an #else directive, the statements between it
   and the #endif directive will be compiled only if the identifer was
   not defined.

   Conditional compilation blocks may be nested.

 Example
   #define EXAMPLE_DIRECTIV
   #include example.hdr

   #define EXPIRE
   
   proc Test_853
   ? "Program started..."
   
   #ifdef EXPIRE
      ? "Demo version will now quit"
      wait
      quit
   #endif
   
   ? "Program running..." // not executed in demo version
   endproc

   proc main
   Test_853()
   endproc

See Also: #else #ifndef

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