[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 #ifndef
 Compile a section of code if an identifier is undefined
------------------------------------------------------------------------------
 Syntax

     #ifndef <identifier>
        <statements>...
     [#else]
        <statements>...
     #endif

 Arguments

     <identifier> is the name of a definition whose absence is being
     verified.

 Description

     #ifndef...#endif lets you perform conditional compilation by identifying
     a section of source code to compile if the specified <identifier> is
     undefined.

     The #else directive specifies the code to compile if <identifier> is
     defined.  The #endif terminates the conditional compilation block.

 Examples

     .  This code fragment is a general skeleton for conditional
        compilation with #ifndef:

        #define DEBUG
        .
        . <statements>
        .
        #ifndef DEBUG
           <optimized version of code>
        #else
           <debugging version of code>
        #endif

     .  This example compiles a section of code if a specific
        identifier is undefined.

        In DOS:

        C>CLIPPER Myfile

        In the program (.prg) file:

        #ifndef NODEBUG
           Assert(<some condition>)
        #endif

     .  This example overrides a default definition in the program
        (.prg) file using a manifest constant defined on the compiler command
        line with the /D option

        In DOS:

        C>CLIPPER Myfile /DM_MARGIN=10

        In the program (.prg) file:

        #ifndef M_MARGIN
           #define M_MARGIN   15
        #endif


See Also: #define #ifdef
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson