c/preprocessor/conditional

The preprocessor supports conditional compilation of parts of source file. This behavior is controlled by, , , , , and directives.

Explanation
The conditional preprocessing block starts with, or  directive, then optionally includes any number of  directives, then optionally includes at most one  directive and is terminated with  directive. Any inner conditional preprocessing blocks are processed separately.

Each of, , , , and directives control code block until first , ,  directive not belonging to any inner conditional preprocessing blocks.

, and  directives test the specified condition (see below) and if it evaluates to true, compiles the controlled code block. In that case subsequent and  directives are ignored. Otherwise, if the specified condition evaluates false, the controlled code block is skipped and the subsequent or  directive (if any) is processed. If the subsequent directive is, the code block controlled by the directive is unconditionally compiled. Otherwise, the directive acts as if it was  directive: checks for condition, compiles or skips the controlled code block based on the result, and in the latter case processes subsequent  and  directives. The conditional preprocessing block is terminated by directive.

The is a constant expression, using only constants and identifiers, defined using  directive. Any identifier, which is not literal, non defined using directive, evaluates to 0.

The expression may contain unary operators in form  or   which return  if the  was defined using  directive and 0 otherwise. If the evaluates to nonzero value, the controlled code block is included and skipped otherwise. If any used identifier is not a constant, it is replaced with.

Note: Until DR 412, ...  is different from  ...  followed by  because if  is true, the second  is skipped and  does not need to be well-formed, while #elif's  must be a valid expression. As of DR 412, #elif that leads the skipped code block is also skipped.

Combined directives
Checks if the identifier was defined as a macro name.

is essentially equivalent to.

is essentially equivalent to.