This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: stupid C preprocessor question


"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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]