gcc -std=c89 -xc++ undefines __cplusplus

Neil Booth neil@daikokuya.co.uk
Sat Aug 24 01:07:00 GMT 2002


Danny Smith wrote:-

> Specifying -std=c89 with -xc++ undefines __cplusplus, but
> leaves __GNUG__ defined.

I suggest you don't do this; -std=c89 is not a C++ switch
and 3.3 will tell you that (I originally had it an error,
but was asked to make it a warning.  Trying it out now
gives

$ gcc -std=c89 -x c++ /tmp/foo.c
cc1plus: warning: "-std=c89" is valid for C/ObjC but not for C++
cc1plus: error: unrecognized option `-std=c89'

so it's both 8-)  I need to fix this.)

Neil.



More information about the Gcc mailing list