Re: preprocessing statements
"Walter Roberson" <roberson@ibd.n rc-cnrc.gc.cawrote in message
news:g1hn6u$nhj $1@canopus.cc.u manitoba.ca...
Priceless.
Bill
"Walter Roberson" <roberson@ibd.n rc-cnrc.gc.cawrote in message
news:g1hn6u$nhj $1@canopus.cc.u manitoba.ca...
In this thread you did not ask about #if vs #ifdef . They do not mean
the same thing. For example,
>
#define FOO 0
#ifdef FOO
/* this section *will* be compiled, because FOO -is- defined. */
#endif
#if FOO
/* this section will *not* be compiled, because FOO's value is 0,
and #if 0 is false */
#endif
#ifdef if
/* this section will *not* be compiled, because the macro if is -not-
defined. */
#endif
#if !if
/* this section *will* be compiled. In a #if line, after all known
macros are expanded, all remaining identifiers have the value 0
substituted, without any consideration as to whether the identifiers
might be C keywords or library functions. With no macro named if,
the line would be equivilent to #if !0 which is #if 1 which is true.
*/
#endif
the same thing. For example,
>
#define FOO 0
#ifdef FOO
/* this section *will* be compiled, because FOO -is- defined. */
#endif
#if FOO
/* this section will *not* be compiled, because FOO's value is 0,
and #if 0 is false */
#endif
#ifdef if
/* this section will *not* be compiled, because the macro if is -not-
defined. */
#endif
#if !if
/* this section *will* be compiled. In a #if line, after all known
macros are expanded, all remaining identifiers have the value 0
substituted, without any consideration as to whether the identifiers
might be C keywords or library functions. With no macro named if,
the line would be equivilent to #if !0 which is #if 1 which is true.
*/
#endif
Bill
Comment