This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: stupid C preprocessor question
- From: Zack Weinberg <zack at codesourcery dot com>
- To: "Steven G. Kargl" <kargl at troutmask dot apl dot washington dot edu>
- Cc: gcc at gcc dot gnu dot org
- Date: Tue, 23 Mar 2004 22:44:47 -0800
- Subject: Re: stupid C preprocessor question
- References: <200403240605.i2O65fE0033863@troutmask.apl.washington.edu>
"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