Why doesn't g++ use the latest standard by default?

The latest standard is c++14, so why doesn't g++ enable it by default? Is there a reason to not have this enabled in new projects?
Last edited on
If you create a new project and you have the latest GCC, then it is no trouble for you to add the -std=c++14 into your build config and write C++14 conformant code.

However, if you have dozens of legacy projects that all have to be recompiled regularly (say, for each Ubuntu release), then you have more than enough to worry and duct-tape even without compiler suddenly changing its default behaviour.

One more consideration. To whom do you plan to distribute? Only to platform, where you develop? Or perhaps to as many platforms as possible? Do they all have a C++14-supporting compiler? Do you use third-party libraries? Do they work with C++14?
Clang also defaults to --std=c++03 and I'd expect most, if not all, compilers to do the same.
It looks like g++ version 6 (should be out in a couple of months) will default to -std=gnu++14 instead of -std=gnu++98.
Also gcc version 5 defaults to -std=gnu11 instead of -std=gnu89 for C programs.

Note that by default the gcc/g++ compiler support gcc extensions to the language by default. If you don't want these extensions you must so specify.

Topic archived. No new replies allowed.