lundi 27 juin 2016

Mixing different C++ standards with GCC

I have the following scenario:

There are two components one is written in C++11 the other in C++98. Both are compiled from scratch using the same GCC 4.9. One uses the implicit default --std=gnu++98 the other explicitly sets --std=c++11.

Even after doing some research I could not completely answer the question if this could cause issues.

The GCC wiki says:

The C++98 language is ABI-compatible with the C++11 language, but several places in the library break compatibility. This makes it dangerous to link C++98 objects with C++11 objects. If you can recompile your code in matching versions of the language, you should do that.

This suggest that problems are to be expected.

So the questions are:

  1. Are there issues if the two components built with --std=gnu++98 and --std=c++11 are linked together, even tough they use same libstdc++ and are built with the same compiler (GCC 4.9)?

  2. Does Dual ABI support form GCC 5.1 have an influence in that case?

Aucun commentaire:

Enregistrer un commentaire