C5_#ifndef

#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

Advertisements

5 responses to “C5_#ifndef

  1. Pingback: C5_#undef | Viva Clipper !

  2. Pingback: C5_#ifdef | Viva Clipper !

  3. Pingback: C5_#error | Viva Clipper !

  4. Pingback: C5_#define | Viva Clipper !

  5. Pingback: C5 Directives | Viva Clipper !

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.