[bug] amazing preprocessor bug

[bug] amazing preprocessor bug

Post by Markus F.X » Sat, 21 Aug 2004 16:24:28


Today's lesson: fun with the preprocessor

Please try to compile this simple 3-liner:

#if (4 >> 1 >> 1 != 1)
#error
#endif

--> fatal error C1012 !?

Now let's omit parentheses and try again:

#if 4 >> 1 >> 1 != 1
#error
#endif

--> warning C4067, and the #if computation is wrong !!

Same things happen if you use "<<" or mix them.

Finally it's interesting to note that this problem seems to be present
at least since MSC 6.0 (this is _MSC_VER == 600 back from 1990). And it
has been confirmed to persist in the latest VS 2005 betas :-)

Regards,
Markus F.X.J. Oberhumer
< XXXX@XXXXX.COM >
 
 
 

[bug] amazing preprocessor bug

Post by David Lown » Sun, 22 Aug 2004 17:34:56

>Finally it's interesting to note that this problem seems to be present

Have you filed a bug report on it for VS2005?

http://www.yqcomputer.com/

Dave
--
MVP VC++ FAQ: http://www.yqcomputer.com/

 
 
 

[bug] amazing preprocessor bug

Post by Carl Danie » Sun, 22 Aug 2004 23:20:53


I'd go ahead and file it, but I know that the VC team is aware the the
preprocessor has quite a number of conformance issues.

-cd
 
 
 

[bug] amazing preprocessor bug

Post by David Lown » Wed, 25 Aug 2004 03:51:47

>Please try to compile this simple 3-liner:

The following seems OK with the 2005 beta:

#if (4 >> 1) >> 1 != 1

Is that a possible work-around for now?

Dave
--
MVP VC++ FAQ: http://www.yqcomputer.com/
 
 
 

[bug] amazing preprocessor bug

Post by David Lown » Wed, 25 Aug 2004 04:04:55

For the sake of making a note of it, I've reported it against VS2005:

http://www.yqcomputer.com/

Dave
--
MVP VC++ FAQ: http://www.yqcomputer.com/