C preprocessor failure

Dave Brolley brolley@redhat.com
Mon May 15 10:31:00 GMT 2000


Stephen Olsen wrote:

> Neil,
>
> Take a look at what Henry found.
>
> Thanks Henry, for finding the reference in K&R.
>
>
> Henry Sobotka <sobotka@axess.com>:
>
>> Stephen Olsen wrote:
>> >
>> > Could you point me to any specification that says things within
>> > #ifdef/#endif's must be able to compile even though they are specfically
>> > excluded from being compiled?
>>
>> K&R (A12.5 - Conditional Compilation) says the opposite: "Text
>> controlled by the inactive arms of the conditional is ignored except for
>> checking the nesting of conditionals."
>>
>> Henry
>>

Right -- K&R preprocessing was text based and, in my experience, did not
warn about tokenization errors within a FALSE conditional block. I think
that gcc should behave this way in -traditional mode. For ANSI mode,
however, this is a valid warning since, according to the phases of
translation, tokenization takes place before directives are interpreted.

Dave



More information about the Gcc-bugs mailing list