stupid C preprocessor question
Zack Weinberg
zack@codesourcery.com
Wed Mar 24 17:47:00 GMT 2004
"Steven G. Kargl" <kargl@troutmask.apl.washington.edu> writes:
>
> I'm translating a large chunk of Fortran to C. The use of
> #if 0 ... #endif makes it much easier.
I don't see why /* */ don't work for you.
> I don't have access to the C99 standard, but Harbison and Steele
> state in a discussion of #if ... #endif constructs that "A group of
> lines that is discarded is not processed by the preprocessor." (H&S,
> 5th ed. page 62).
>
> kargl[202] gcc -c a.c
> a.c:5:7: missing terminating ' character
>
> It appears that gcc is preprocessing the discarded lines.
What H&S mean is that if you write
#if 0
#define FOO bar
#endif
FOO is not defined as a macro. Lines inside a failed #if are still
tokenized (they have to be - how else to find the #endif?
zw
More information about the Gcc
mailing list