Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it ok mixing compiler option std=c++11 with older compiler options std=c++0x

Tags:

c++

c++11

Upgraded C++ compiler to 4.8.5. If linked with 2 different compiled objects std=c++11 and std=c++0x whether unpredictable behaviour possible? The STL lib has 2 versions. One for C++98 and another for C++11. C++ STL shows 2 versions for each library function. Whether STL will misbehave if linked with 2 different compiled objects

like image 212
user10943878 Avatar asked Dec 02 '25 10:12

user10943878


1 Answers

Usually, standards are backward compatible, however there are other things related to them that can break your code.

For example, in older standards (pre C++11) you couldn't use -frtti, and, if you use it, you will change physical memory layout for objects made from the same headers used by C++98 and f.e. C++11 compiled objects.

In some cases, you may need to add some flags to make your new objects compatible/linkable with older-standard objects.

like image 98
ufoq Avatar answered Dec 04 '25 01:12

ufoq



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!