#ifndef

The #ifndef directive checks whether a macro is not defined.

If the identifier specified is not defined as a macro, the lines of code immediately follow the condition are passed on to the compiler.

The preprocessor #ifndef directive has the form:

                          .----------------.
                          V                |
>>-#--ifndef--identifier----token_sequence-+-------------------->
 
>--newline_character-------------------------------------------><
 
 

An identifier must follow the #ifndef keyword. The following example defines MAX_LEN to be 50 if EXTENDED is not defined for the preprocessor. Otherwise, MAX_LEN is defined to be 75.

#ifndef EXTENDED
#   define MAX_LEN 50
#else
#   define MAX_LEN 75
#endif
IBM Copyright 2003