This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
preprocessor weirdness
- To: gcc at gcc dot gnu dot org
- Subject: preprocessor weirdness
- From: <lindholm at possessive dot stanford dot edu>
- Date: Sun, 9 Jul 2000 20:23:14 -0700 (PDT)
I'm trying to get g++ to parse the Win2k DDK header files (not to produce
code, it's for a semantic-checking project). I came across an error on
this rather unusual code (in wtypes.h of the DDK):
#if !__STDC__ && (_MSC_VER <= 1000)
/* For backward compatibility */
typedef VARIANT_BOOL _VARIANT_BOOL;
#else
/* ANSI C/C++ reserve bool as keyword */
#define _VARIANT_BOOL /##/
#endif
I take it that, under VC++, _VARIANT_BOOL is now equal to "//" and where
it appears later in code, it comments out the rest of the line. That
doesn't happen in g++, it gives me an error:
/home/lindholm/WINDDK/2195/inc/oaidl.h:439: parse error before `/'
/home/lindholm/WINDDK/2195/inc/oaidl.h:454: parse error before `/'
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?