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]

preprocessor weirdness



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?




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