On Mon, Oct 10, 2011 at 5:25 PM, Joe Buck <joe.b...@synopsys.com> wrote:
> On Fri, Oct 07, 2011 at 07:35:17PM -0700, Gabriel Dos Reis wrote:
>> C++11 is essentially binary incompatible with C++98.
>
> Only partially.  The layout for user-defined classes is the same, and

PODness has changed from C++98.


> code sequences for calls that don't include new features like rvalue
> references is the same.  Some very important classes from the standard
> library are different, and that creates an incompatibility.

It is not just class layout.  It is also function signatures.

>
>> The best thing people should do is to take it seriously that that they should
>> not attempt to mix or play loose.
>
> Unfortunately, distros aren't going to start shipping two versions of
> every C++ library, so people are going to have to solve the problem that
> you are saying should not be solved, or at least determine which cases
> are problems and which aren't.  If common libraries are all c++98-only
> this will slow the adoption of c++11: forcing a flag day when this is not
> necessary is probably not the right thing to do.

By no means am I preventing anybody from solving that problem if they
believe that is how their time is best spent.  I am offering only a realistic
assessment.  When distros deam g++ support for C++11 sufficiently
well advanced that they feel adventurous enough to officially support
the experimental support, then I am confident they will do the responsible
thing: offer two sets of libraries, as they did in the past when we
moved to GCC3.

>
> I wrote:
>> Eventually there would need to be one libstdc++ that programs link against 
>> and
>> run whether they use c++98 or c++11. I would expect there to be restrictions,
>> but it's a problem that eventually needs to be tackled.
>
> Gaby writes:
>
>> My opinion is that it would an exercise in futility, frustration, and
>> possibly deception to try to make people believe that there are sets of
>> simple rules they can follow to mix their C++98 binaries with fully
>> compatible C++11 library.  They would have to recompile the source code.
>
> They will need to build their code with the same compiler, yes, and it
> won't be binary-compatible with older versions.  But as of today, the
> templates in libstdc++ expand differently depending on language mode, so
> the library is already providing both sets of interfaces.

For the record, I am not endorsing this as a recommendation for those
interested in C++11 -- I am already stated my recommendation.

>
> A bump to libstdc++ major version number could be made that ensures, for
> example, that std::string satisfies the requirements of both languages.
> It's also possible that the code in the standard library uses c++11 features
> internally even when the user has specified c++98 (to get move semantics,
> for example).
>
>

Reply via email to