#ifndef, Conditional compilation directives
Syntax:
#if
#else
#endif
#if
#elif
#endif
1.The compiler only compiles the lines that follow the #if directive when evaluates to non-zero.
2.Otherwise, the compiler skips the lines that follow until it encounters the matching #else or #endif.
3.If the expression evaluates to false and there is a matching #else, the lines between the #else and the #endif are compiled.
4.#if directives can be nested, but matching #else and #endif directives must be in the same file as the #if.
5.#elif is like #else except the else block is only compiled if the expression after #elif is non-zero.
Syntax:
#if
#else
#endif
#if
#elif
#endif
1.The compiler only compiles the lines that follow the #if directive when evaluates to non-zero.
2.Otherwise, the compiler skips the lines that follow until it encounters the matching #else or #endif.
3.If the expression evaluates to false and there is a matching #else, the lines between the #else and the #endif are compiled.
4.#if directives can be nested, but matching #else and #endif directives must be in the same file as the #if.
5.#elif is like #else except the else block is only compiled if the expression after #elif is non-zero.
#ifndef
evaluates to 1 if the symbol specified by has not been defined.
Example
#ifndef Quiet PrintDiagnostics(); #endif |
0 comments:
Post a Comment