C Language and Libraries Help (clang.hlp) (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
#ifdef and #ifndef
                                             Up Contents Index Back
─────C/C++ Language─────────────────────────────────────────────────────────
 
  Directive:  #ifdef
              #ifndef
 
  Syntax:     #ifdef identifier
              #ifndef identifier
 
  Summary:    Tests whether <identifier> is currently defined. The
              #ifdef directive returns true (nonzero) if it is currently
              defined and returns false (0) if it is not. The #ifndef
              directive returns the opposite. The #if directive combined
              with the defined operator is preferred for all new programs
              because they can be used in expressions that check multiple
              conditions on the same line. For example:
 
                   #ifdef __cplusplus
                   #ifdef M_I8086
                   #pragma message ("C++ and 8086/88")
                   #endif
                   #endif
 
                   #if defined( __cplusplus ) && defined( M_I8086 )
                   #pragma message ("C++ and 8086/88")
                   #endif
 
  See also:   #if, defined, #undef, #define
                                    -♦-