This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: C++98/C++11 ABI compatibility for gcc-4.7

> On 31 May 2012 22:35, James Y Knight wrote:
>> I understand that the ABI changes generally cannot be avoided, but a lot
>> of pain for a lot of people could be avoided by making things fail
>> obviously with a link error, instead of sometimes, arbitrarily, if
>> you're
>> lucky, you'll get a segfault at runtime.
> Do you have any suggestions for how to do that?

Sure, I have a suggestion. I'm not an expert here, so perhaps it has
issues, goes anyways.

Inline namespaces could be used in C++11 mode. libstdc++ would include two
copies of all affected objects: one compiled in C++03 mode with the C++03
names, and one compiled in C++11 mode with the C++11 names. Classes should
be given a new name every time they change incompatibly in C++11 mode,
which is probably every release for a number of classes.

For the C++11-specific symbols that'd be exported from libstdc++ when
doing this, you'd have to decide whether to let them appear and disappear
every GCC release without a pretense of backward compatibility (c++11 mode
being experimental, after all), or, to preserve enough of the old class
definitions internally to the library that the old symbols with the old
behavior can continue being exported, even when the classes have been
modified (nicer for users, but harder on implementors).

Also helpful, even before a technical solution has been created, would be
for the incompatibility to mentioned prominently in the GCC manual when
describing the -std=c++0x/11 option, and in big letters on

As I said, pretty much nobody even knows that this is a problem, unless
they follow the GCC mailing lists or until they run into it independently
and figure out what's happened. Since GCC 4.7 implements a fair portion of
C++11, and C++11 is starting to gain a lot of traction, I'd expect these
issues to start coming up more and more frequently, as more and more
people start compiling their programs in C++11 mode.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]