Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is GCC ready for C++14 production code?

Tags:

c++

gcc

c++14

In this web page, GCC's support for the ISO C++14 standard is defined "experimental".

Since I'd like to use some of the C++14's improvements on C++11 (e.g. std::make_unique and generic lambdas) in my C++ code, am I safe in using the -std=c++14 option with GCC 4.9 for production code, or is current GCC/C++14 status kind of like "beta" and so GCC/C++14 not ready for production code?

like image 467
Mr.C64 Avatar asked Mar 09 '15 01:03

Mr.C64


1 Answers

is current GCC/C++14 status kind of like "beta" and so GCC/C++14 not ready for production code?

It depends which features you use. make_unique is very simple, was easy to implement, and should be safe to rely on.

Some of the other new features (especially core language features) took a lot more work to implement and might have more bugs waiting to be found and fixed.

So there's no single "it's ready" or "it's not ready" answer.

However, one important thing to be aware of is that while it's still labelled as experimental there is no attempt to maintain backward compatibility between GCC 4.x and GCC 5, for instance. So if you have C++11 code built with GCC 4.8 you need to recompile it all if you want to link to other C++11/C++14 objects built with 4.9, and similarly if/when you move to GCC 5: recompile all objects that use C++11 or C++14 (because types such as std::tuple changed data layout in GCC 5).

For C++03 code we don't change definitions between releases, so they are stable.

like image 123
Jonathan Wakely Avatar answered Nov 18 '22 14:11

Jonathan Wakely