Am Donnerstag, 19. Dezember 2013, 16:23:08 schrieb Jan Kundrát:
> On Thursday, 19 December 2013 16:00:13 CEST, Ian Stakenvicius wrote:
> > A change in profiles?  14.0/* adds that to the default CXXFLAGS in
> > base, new stage3's etc are all rolled with this.  We recommend
> > migration to 14.0 profile and have a check somewhere about
> > "-std=c++11" missing from CXXFLAGS in case it's overridden in
> > make.conf, so users put it in place?
> 
> Before you invest any more time in this, please understand that C++98 and
> C++11 are source-incompatible. There is no way to expect that a package
> builds fine when you throw -std=c++11 on it. And even if you patched them
> all, you are breaking an unknown number of 3rd party software over which
> you have exactly zero control.

No. If you do something against the standard that is working due to lack of 
control when compiling with -std=c++98, then your source code is severly 
broken. Most developers will use C++03 (plus tr1) anyway, won't they?

And no, the languages are _not_ "source-incompatible". That would be a 
scandal!

But if you have your C++98/03 code, and do what most developers do and let 
your console be flooded with warnings you ignore, you must not be surprised, 
if the compilation fails when you decide to throw
"-std=c++11 -Wall -Wextra -Wpedantic -fsanitize=address -fsanitize=thread"
with gcc 4.8.2 at it.

There is absolutely no reason to expect a compilation to fail with C++11, if 
it went well with C++03 and "-Wall -Wextra -pedantic".

If you try to outsmart your compiler, it will get it's revenge very soon and 
very hard.

And according to [1] it goes even further:
Quote:
> If you use C++11 then in general you can combine C++11 code built with GCC
> 4.X and C++03 code built with any GCC, but there is not the same guarantee
> that you can combine with C++11 code built with GCC 4.Y or GCC 4.Z, because
> the C++11 features are not all stable yet (e.g. for GCC 4.9 I'm about to add
> a new virtual function to a base class in <future>.) This is why C++11
> support is still labelled "experimental", because it would be worse to claim
> it's stable and then have to break the ABI.

So basically C++11 <-> C++03 is no problem at all (unless you *export* certain 
symbols [2]), but combining C++11 from different gcc versions is nowhere 
guaranteed to work.

Cheers

Sven


[1] : https://lwn.net/Articles/552831/
[2] : http://gcc.gnu.org/wiki/Cxx11AbiCompatibility

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to