According to the ANSI C standard, the #if and #elif directives can be nested at least eight levels.
For example, the #if directive is nested in the following code segment:
#if MACRO_NAME1
#if MACRO_NAME2
#if MACRO_NAME3
printf("MACRO_NAME1, MACRO_NAME2, and MACRO_NAME3\n");
#else
printf("MACRO_NAME1 and MACRO_NAME2\n");
#endif
#else
printf("MACRO_NAME1\n");
#endif
#else
printf("No macro name defined.\n");
#endif
Here the #if directive is nested to three levels. Note that each #else or #endif is associated with the nearest #if.
Saturday, October 17, 2009
Subscribe to:
Post Comments (Atom)

No comments:
Post a Comment