#if directive
Conditional compilation directives
Syntax:
#if
#else
#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.
Conditional compilation directives
Syntax:
#if
#else
#endif
1)The compiler only compiles the lines that follow the #if directive when
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.
Example
#if defined(NEARPOINTERS) space = farcoreleft(); #elif defined(FARPOINTERS) space = coreleft(); #else #error Unsupported memory model #endif |
0 comments:
Post a Comment