This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: preprocessor weirdness
- To: <lindholm at possessive dot stanford dot edu>
- Subject: Re: preprocessor weirdness
- From: Geoff Keating <geoffk at cygnus dot com>
- Date: 09 Jul 2000 21:19:42 -0700
- CC: gcc-bugs at gcc dot gnu dot org
- References: <Pine.LNX.4.10.10007092013060.8325-100000@possessive.stanford.edu>
<lindholm@possessive.stanford.edu> writes:
> #define _VARIANT_BOOL /##/
> I've never seen anything like this before, so I'm guessing that the author
> was just taking advantage of a quirk in the VC++ parser. Is this right?
> This isn't ANSI-compliant code, is it?
Yes, it's not ISO-compliant. I think it's most likely a typo for /**/.
I believe that this results in undefined behaviour if the macro is
ever used, because '//' is not a preprocessing token. If I'm wrong,
then what you end up with is a '//' in the token stream, which would
be a syntax error. It doesn't comment out the rest of the line
because comments are removed before macro replacement is done.
--
- Geoffrey Keating <geoffk@cygnus.com>