Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage News What changes brought by C++14 could break a C++11 program?

What changes brought by C++14 could break a C++11 program?

This item in japanese

C++14, the new C++ standard succeeding C++11, will bring a host of changes to the language. Although it is planned to be a small extension over its predecessor, featuring mainly bug fixes and small improvements, it is inevitable that a few changes might make a correct C++11 program break under a C++14-compliant compiler.

An overall view of all of changes that the new standard will likely bring can be found on the Open Standards web page, while more synthetical views can be found elsewhere.

While the name C++14 suggests a release in 2014, this date is not fixed. Actually, the working draft of the language, N3936, was published on March 2, 2014 and if all national bodies approve it, the C++14 International Standard will be published in late summer.

Support for the new language features is also well underway on major C++ compilers: Clang "fully implements all of the current draft"; GCC and Visual Studio also offer some support for C++14 new features.

Most of C++14 new features will not break source compatibility with current C++11 standard. The introduction of generic lambdas, e.g., allowing lambda function parameters to be declared with the auto type specifier, will not break compatibility with C++11 lambdas. However, it is foreseen that a number of new features will indeed be cause for some concerns. Thus, Stack Overflow user Filip Roséen collected all the relevant information that he could found in the working draft itself.

Here is a short list of changes that could potentially break C++11:

  • Digit Separators

    The digit separator was introduced so that one could, in a more readable manner, write numeric literals and split them up in a more natural way.

  • Sized Deallocation

    C++14 introduces the opportunity to declare a global overload of operator delete suitable for sized deallocation, something which wasn't possible in C++11.

  • constexpr member-functions, no longer implicitly const

    There are many changes to constexpr in C++14, but the only change that will change semantics between C++11, and C++14 is the constantness of a member-function marked as constexpr.

  • Removal of std::gets

    std::gets has been removed from the Standard Library because it is considered dangerous.

For a more detailed discussion, including code samples, and references to C++ drafts, see the post on Stack Overflow.

Rate this Article