Re: Using C++11



On Sun, 28 Jun 2015 20:17:28 +0200
Murray Cumming <murrayc murrayc com> wrote:
On Wed, 2015-06-24 at 13:17 +0200, Murray Cumming wrote:
On Wed, 2015-06-24 at 09:27 +0200, Murray Cumming wrote:
Please see https://gcc.gnu.org/ml/gcc/2015-05/msg00075.html.

I don't see any reply to your question. So I'm still stuck with
wanting to use C++11 but having a big official warning telling me
not to.

Nevertheless, maybe we can do some things already. Feedback welcome:
https://bugzilla.gnome.org/show_bug.cgi?id=751432

Given that --std=c+11 breaks ABI compatibility (at least in the
standard library), I wonder if/when distros would ever build glibmm
with C++11 support.

gcc-3.4 and gcc-4.* do not provide libstdc++ with a C++11 compliant ABI
(this is mainly concerned with gcc's copy on write string
implementation) and gcc-5.1 does by default do so, but this is
selectable at gcc compilation time, and I should not worry about it for
gtkmm, because whatever default configuration distributions ship with
(including with respect to gtkmm), they ship with.  All gtkmm needs to
do is test at configuration time for the earliest version of gcc that
it is intended to compile with, and ensure that the library is compiled
with the -std=c++0x or -std=c++11 flag.  In a library I distribute, I
do this with some very simple autoconf macros.

You can compile libstdc++ in gcc-5.1 with both ABIs simpultaneously.
The default ABI is determined by whether gcc was compiled with the
--with-default-libstdcxx=c++98, --with-default-libstdcxx=c++11 or
--disable-libstdcxx-dual-abi flags. The last of those sticks with the
gcc-3.1/4.* ABI and does not provide the new one at all.  The other two
compile libstdc++ with both ABIs, and differ only in the default.  User
programs can override the default by defining _GLIBCXX_USE_CXX11_ABI
when compiling the program. Setting it to 0 will pick the old ABI, and
setting it to 1 will pick the new one.

For example Redhat intends its next distribution of Fedora after the
release of gcc-5 (possibly now its current release?) to have libstdc++
compiled with the --with-default-libstdcxx=c++98 flag.  It has
announced that its following release will be compiled with the
--with-default-libstdcxx=c++11 flag.

Library suppliers don't need to worry about it except in the very
unlikely event that they want to allow distributions to install a
version of their library for each ABI, in the same way that libstdc++
does with gcc-5.1.  This can be done by using special purpose ABI tags.
In my view that would be unnecessary for gtkmm and I should be very
surprised if any common C++ libraries, including Qt, bother with that.

Chris


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]