ILE C/C++ Compiler Reference

#if, #elif

The if and elif directives compare the value of the expression to zero.

If the constant expression evaluates to a nonzero value, the tokens that immediately follow the condition are passed on to the compiler.

If the expression evaluates to zero and the conditional compilation directive contains a preprocessor elif directive, the source text located between the elif and the next elif or else directive is selected by the preprocessor to be passed on to the compiler. The elif directive cannot appear after the else directive.

All macros are expanded, any defined() expressions are processed and all remaining identifiers are replaced with the token 0.

                                     .----------------.
                                     V                |
>>-#--+-if---+--constant_expression----token_sequence-+--------><
      '-elif-'
 
 

The expressions that are tested must be integer constant expressions with the following properties:

Note:
If a macro is not defined, a value of 0 (zero) is assigned to it. In the following example, TEST must be a macro identifier:
#if TEST >= 1
   printf("i = %d\n", i);
   printf("array[i] = %d\n", array[i]);
#elif TEST < 0
   printf("array subscript out of bounds \n");
#endif


[ Top of Page | Previous Page | Next Page | Table of Contents ]