Directive #elseifdef


Directive #elifdef
Directive #elseifdef

#elifdef
#elseifdef

Description

These work as a combined #else and #ifdef without adding an extra level of nesting.

Example

The following two are equivalent:

#ifdef A
    // Code for A.
  #else
  #ifdef B
    // Code for B.
  #else
  #ifdef C
    // Code for C.
  #else
    // Code for D.
  #endif
  #endif
  #endif

And

#ifdef A
    // Code for A.
  #elifdef B
    // Code for B.
  #elseifdef C
    // Code for C.
  #else
    // Code for D.
  #endif
See also

#if, #ifdef, #else, defined(), constant()