The compif Statement

The compif statement works together with the compelse and compend compiler statements to create a compile-time if-else statement that enables you to control whether or not sections of code should be included in the compiler output. The compif statement takes a comparison constant as its first argument. The second and third arguments must be constants or constant expressions that can be evaluated by the compiler during program compilation. If the comparison expression is true then code immediate following the statement will be included in the executable. The compiler if statement ends when the compiler finds the next compend statement. To optionally provide an else clause use the compelse statement between the compif and compend statements. Valid comparison constants are listed in the Comparison Constants section. The syntax of the compif statement is demonstrated in the example below.

 compif EQ, sizeof(arg3), 2
   // compile this if sizeof(arg3) == 2
   // compile this if sizeof(arg3) != 2

Generated by  doxygen 1.6.2