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]

Re: C++ preprocessor bug or not ?


No --- this should not work. 'xor' is not a keyword like 'if'. It is an 
alternate form of the token '^'. Specifying

#if defined(xor)

should yield the same result as

#if defined(^)

The error which was given is correct and *is* a parse error.

Dave

Nathan Sidwell wrote:

> John Levon wrote:
> 
>> The following code (cut from qt 1.45) :
>> 
>> #if defined(xor)
>> // blah
>> #endif
>> 
>> is not appreciated by g++ > 2.95.2
> 
> this should work, see attached where I've tried `if' too. `if' works, `xor' does
> not.
> Please file bug report
> nathan@uha:6>./g++ -B ./ -E current/zap.C 
> # 4 "current/zap.C"
> current/zap.C:7:14: "defined" without an identifier
> not if
> 
> 
> 
> 
> 
> not xor
> 
> 
> ouch!
> 
> nathan
> 
> 
> ------------------------------------------------------------------------
> 
> #if defined (if)
> is if
> #else
> not if
> #endif
> 
> #if defined (xor)
> is xor
> #else
> not xor
> #endif
> 
> zap.C
> 
> Content-Type:
> 
> text/plain
> Content-Encoding:
> 
> 7bit
> 
> 


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