Gentoo Archives: gentoo-dev

From: "Jan Kundrát" <jkt@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] How to support C++11 in libraries?
Date: Fri, 20 Dec 2013 12:45:45
Message-Id: e97d92da-adfd-4a4e-9eb3-fa1958ff5f63@gentoo.org
In Reply to: Re: [gentoo-dev] How to support C++11 in libraries? by Sven Eden
1 On Friday, 20 December 2013 12:56:43 CEST, Sven Eden wrote:
2 > And no, the languages are _not_ "source-incompatible". That would be a
3 > scandal!
4
5 You might argue about this, but that doesn't change these facts. This is
6 absolutely valid C++98 program:
7
8 jkt@svist ~ $ cat foo.cpp
9 int main() {
10 auto int foo;
11 return 0;
12 }
13 jkt@svist ~ $ g++ -std=c++98 -pedantic foo.cpp
14 jkt@svist ~ $ echo $?
15 0
16
17 ...which will *not* build under the C++11 mode:
18
19 jkt@svist ~ $ g++ -std=c++0x foo.cpp
20 foo.cpp: In function ‘int main()’:
21 foo.cpp:2:14: error: two or more data types in declaration of ‘foo’
22
23 Yes, -Wc++0x-compat warns about this, yes, it's included in -Wall, but it
24 does not change the fact that there *is* code out there which does conform
25 to C++98 standard, does *not* try to "outsmart the compiler", and which
26 will not build in the C++11 mode. Do we really have to be having this
27 discussion?
28
29 Cheers,
30 Jan

Replies

Subject Author
Re: [gentoo-dev] How to support C++11 in libraries? Georg Rudoy <0xd34df00d@×××××.com>
[gentoo-dev] Re: How to support C++11 in libraries? Martin Vaeth <vaeth@××××××××××××××××××××××××.de>