◄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 -♦-