Current C++ Standard Version
The current C++ standard is C++23
1 or officially known as 14882:2024
or ISO International Standard ISO/IEC 14882:2023 - Programming Language C++
. The official C++23 standard was published on October 19, 2024 2. The ISO/IEC 14882:2024
superseeds ISO/IEC 14882:2020
standard (C++20). ISO/IEC 14882:2024
is the 7th edition of the standard. The standard increased by about 14% in number of pages. Although an official copy of the stanard costs money, drafts of the standard can be found online for free 3.
Compiler Support
Compiler developers generally get a head start by implementing drafts of the standard, but this does not mean all compilers have full support for C++23. Full support is difficult to accomplish and sometimes takes many years after publication.
GCC and Clang have better language support whereas MSVC has better standard library support. These are based on the latest versions of the compiler4.
C++23 Core language support (about 43 features)
GCC | Clang | MSVC |
---|---|---|
98% | 88% | 21% |
C++23 library features (about 103 features)
GCC libstdc++ | Clang libc++ | MSVC STL |
---|---|---|
81% | 71% | 94% |
Origin
The programming language C++ evolved from C language
C++ was created by Bjarne Stroustrup. Dr. Stroustrup created C++ as a direct descendant of C language (specifically, descendant of Classic C and C89
). Technically, C++ is not a descendant of C99
(therefore they are siblings). 5
C++ supports data abstraction, object-oriented programming (OOP), and generic programming. C++ can be considered a better language than C because C++ supports more programming styles, while being a superset of C. Some programmers write in C++ but only use C functionality (e.g., C99).
Standards Committee
C++ is standardized by the ISO (International Organization for Standardization) and the IEC (International Electrotechnical Commission), typically referred to as the “ISO Committee”. The ISO/IEC C++ Committee was founded in 1991, thus before 1991, the standards did not have official ISO standard. The official C++ standard is named ISO/IEC 14882:YEAR
. For example, C++2020 is named ISO/IEC 14882:2020
.
ISO collaborates with other national standard organizations, such as ANSI (The American National Standards Institute), BSI (The British Standards Institute), and DIN (The German national standards organization) 5.
Bjarne Stroustrup is a founding member of the ISO C++ standards committee and has been a major contributor to modern C++.
Current C++ Standard
“C++ current version” is synonymous with current “C++ standard”. The first edition of the ISO standard was “ISO/IEC 14882:1998”. The current C++ standard is C++23, or officially as ISO/IEC 14882:2020 6 and was published in December 2020. C++20 is the sixth edition of the ISO/IEC 14882. Once C++23 standard is completed it will replace the C++20 standard (ISO/IEC 14882:2020) and will be the seventh edition of the C++ standard. C++23 will likely be completed by December 2023.
One can get their own official copy for about $250. Why does the C++ standard cost money? The development, publishing, and maintaining ISO standards costs money, and selling the copies helps cover costs.
Once the official standard is released, then up to compiler vendors (e.g., GNU, Microsoft), to implement the standard into their compilers (e.g., GCC (GNU Compiler Collection) and MSVC (Microsoft Visual C++)).
The ISO group additionally publishes TRs (technical reports) and TSes (technical specifications). A technical specification (TS) decouples new features from the standard, and allows compilers to implement them as std::experimental
for developers to use early.
The ISO/IEC 14882 document specifies requirements for implementations of the C++ programming language. 7. The document is generally not written for the typical developer to use as reference. However, it does provide an official document that developers often point to clarify how the language is suppose to behave. A better and more approachable C++ language reference would be Bjarne Stroustrup’s “The C++ Programming Language”.
Timeline
Year | Milestone | Notable Changes |
---|---|---|
1985 | The C++ Programming Language, 1st edition 8 | Written by Bjarne Stroustrup |
1991 | The C++ Programming Language, 2nd edition 9 | Written by Bjarne Stroustrup |
1998 | C++98 | First C++ ISO standard |
2003 | C++03 | Improvements / fixes |
2011 | C++11 | Major revision |
2014 | C++14 | Improvements / fixes |
2017 | C++17 | Major revision, Published: Nov 30, 2017 |
2020 | C++20 | Published: Dec 15, 2020 |
2024 | C++23 | Published: Oct 19, 2024 |
2026 | C++26 | Under development |
Which Standard Should I pick?
A good place to start is the default standard version picked by the compiler. The default choice leaves the decision to what the compiler thinks is the best to select, likely will be the stable standard. If picking an explicit version, consider starting from C++11 or C++17 and see which features are needed. C++11 was the second major revision by the ISO committee which brought in a lot of new modern features.
In general, it depends on the type of programming that will be done. Newer versions of C++ standard will have more features which make development in C++ more approachable. However, using the standard libraries without understanding how the implementation works might make the application (relatively) slower if performance is critical.
How to select C++ Standard
Visual Studio
Microsoft Visual Studio 2022 supports ISO C++14 Standard, ISO C++17 Standard, and ISO C++20 Standard. MSVS also has a preview of the latest C++ Working Draft. In VS 2022, the default its C++ Language Standard (Project properties –> Configuration Properties –> General) to ISO C++14 Standard.
Standards can be explicitly enabled by using compiler flags such as /std:c++17
for C++17, or alternatively /std:c++latest
, latest draft implementation.
Currently, Microsoft fully supports C++20 : C++20 core language and library features in Visual Studio 2019 version 16.11.0
.
GCC
C++17 is the default mode since GCC 11 (released 4/27/2021). GCC can switch its standard by using the command-line option std=
. For example, -std=c++17
would explicitly enable C++17 standard in GCC 11. C++23 features are available in GCC 11 but is experimental as the standard is not finalized yet. 10.
Check C++ Version of Standard
C++ has predefined macro __cplusplus
which is the version of the C++ standard that is being used:
Standard Version | __cplusplus |
---|---|
Until C++11 | 199711L |
C++11 | 201103L |
C++14 | 201402L |
C++17 | 201703L |
C++20 | 202002L |
C++23 | 202302L |
Code to determine compiler’s version of standard: How to Check C++ Version
-
C++23
is also known asC++2b
. ↩︎ -
Drafts can be found at: C++ - Standards. C++23 draft is available as
N4950
. ↩︎ -
https://www.iso.org/obp/ui/#iso:std:iso-iec:14882:ed-6:v1:en ↩︎