From: Sven Eden <sven.eden@gmx.de>
To: gentoo-dev@lists.gentoo.org
Subject: Re: [gentoo-dev] How to support C++11 in libraries?
Date: Fri, 20 Dec 2013 12:56:43 +0100 [thread overview]
Message-ID: <1479290.p0qqMGJcP8@sed-notebook> (raw)
In-Reply-To: <fb1aa2af-3e4d-45d7-87ec-0942286e6a0f@gentoo.org>
[-- Attachment #1: Type: text/plain, Size: 2504 bytes --]
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 #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 490 bytes --]
next prev parent reply other threads:[~2013-12-20 11:56 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-18 7:54 [gentoo-dev] How to support C++11 in libraries? Michał Górny
2013-12-18 8:20 ` "C. Bergström"
2013-12-18 18:07 ` Michał Górny
2013-12-18 13:58 ` heroxbd
2013-12-18 16:29 ` Jan Kundrát
2013-12-18 16:37 ` "C. Bergström"
2013-12-18 16:50 ` Jan Kundrát
2013-12-18 17:05 ` "C. Bergström"
2013-12-18 17:33 ` Jan Kundrát
2013-12-18 17:47 ` Kent Fredric
2013-12-18 17:56 ` "C. Bergström"
2013-12-19 1:45 ` heroxbd
2013-12-19 8:20 ` Michał Górny
2013-12-19 8:28 ` "C. Bergström"
2013-12-19 8:35 ` Michał Górny
2013-12-19 8:44 ` "C. Bergström"
2013-12-19 12:28 ` Jan Kundrát
2013-12-19 8:45 ` Jan Kundrát
2013-12-19 8:47 ` Georg Rudoy
2013-12-18 17:49 ` "C. Bergström"
2013-12-18 18:28 ` Georg Rudoy
2013-12-19 1:41 ` heroxbd
2013-12-19 8:43 ` Jan Kundrát
2013-12-19 9:18 ` Michał Górny
2013-12-19 13:47 ` heroxbd
2013-12-19 14:46 ` Michał Górny
2013-12-19 15:12 ` heroxbd
2013-12-19 16:56 ` Ciaran McCreesh
2013-12-19 15:17 ` Jan Kundrát
2013-12-19 16:29 ` vivo75
2013-12-19 16:51 ` Jan Kundrát
2013-12-21 2:36 ` [gentoo-dev] " Ryan Hill
2013-12-18 18:15 ` [gentoo-dev] " Michał Górny
2013-12-18 20:58 ` [gentoo-dev] " Martin Vaeth
2013-12-19 2:01 ` [gentoo-dev] " heroxbd
2013-12-18 14:27 ` Ian Stakenvicius
2013-12-18 18:10 ` Anthony G. Basile
2013-12-18 18:28 ` Ian Stakenvicius
2013-12-19 8:58 ` Sven Eden
2013-12-19 9:07 ` Michał Górny
2013-12-19 15:00 ` Ian Stakenvicius
2013-12-19 15:23 ` Jan Kundrát
2013-12-19 16:00 ` Anthony G. Basile
2013-12-20 9:00 ` [gentoo-dev] " Martin Vaeth
2013-12-20 12:35 ` [gentoo-dev] " Jan Kundrát
2013-12-20 17:35 ` [gentoo-dev] " Martin Vaeth
2013-12-20 11:56 ` Sven Eden [this message]
2013-12-20 12:45 ` [gentoo-dev] " Jan Kundrát
2013-12-20 12:54 ` Georg Rudoy
2013-12-20 17:49 ` [gentoo-dev] " Martin Vaeth
2013-12-20 15:10 ` [gentoo-dev] " Ian Stakenvicius
2013-12-19 15:51 ` Anthony G. Basile
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1479290.p0qqMGJcP8@sed-notebook \
--to=sven.eden@gmx.de \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox