c++/3385: -std=foo doesn't work with C++

Joseph S. Myers jsm28@cam.ac.uk
Sat Jun 23 08:57:00 GMT 2001


On Sat, 23 Jun 2001, Daniel Elstner wrote:

> How about the possibility to combine e.g. -std=c99 with -std=c++98
> (as long as they don't contradict each other, always giving the last
> one precedence) ?
> 
> I know that doesn't make much sense since the C and C++ standards
> aren't related, AFAIK.

It doesn't make sense.  If compiling C, specify a C standard version
(possibly a GNU extended one).  If compiling C++, specify a C++ standard
version.  You could define a C++ version meaning c++98 plus C99
extensions, but the base standard (as discussed in the documentation for
-pedantic) would still be c++98.

> The __extension__ keyword didn't work here, and the amount of
> warnings when using -pedantic is rather annoying. Is it possible
> implementing __extension__ for the preprocessor, too?

The correct solution - if you can't or don't want to arrange for glib.h to
be considered a system header and avoid these warnings that way - would be
to implement pragmas for fine-grained warning control.  See
http://gcc.gnu.org/ml/gcc/2000-06/msg00639.html (linked to from the
beginners projects list) for a possible design - except that (web/3119)
this link is currently broken (since April - Jeff Law was going to replace
the corrupt data from the disk the web site had previously been on).

-- 
Joseph S. Myers
jsm28@cam.ac.uk



More information about the Gcc-bugs mailing list