Quick question about c++ versions

Hi, I'm a beginner programmer and I'm having difficulty understand what c++98 and c++11 is. I can't really find much documentation explaining if new IDEs or compilers have c++11 or if that is an extra feature or what. Sorry if i'm sounding a bit dumb but I'm just totally confused. Clearly c++11 is an upgraded version of c++98 with new coding features I'm sure but what I'm wondering is how you tell what version you're using I guess? I really don't even know what I don't know honestly so I'm not really sure what I'm asking. Anyone who could help me understand what these are and why, and if all compilers use the new one or not would be very helpful. Thanks! Sorry for the poorly worded question, I'm just super confused (and new!) but I'm trying to learn.
You can figure out what version you're using by printing out the value of the __cplusplus macro. More info:
http://en.cppreference.com/w/cpp/preprocessor/replace#Predefined_macros
https://isocpp.org/wiki/faq/cpp11
https://isocpp.org/wiki/faq/cpp14

Examples:
C++03: http://coliru.stacked-crooked.com/a/95ef0527fdc15d4d
C++11: http://coliru.stacked-crooked.com/a/72f7e107a740925f
C++14: http://coliru.stacked-crooked.com/a/0c22ccd001fb7ecb
Note that for clang and gcc you need only request the standard you want with the command line option -std=c++14. For Visual Studio, you will always be using the latest version of C++ supported (currently C++14 and some of C++17 in Visual Studio 2015).
Last edited on
closed account (E0p9LyTq)
Any recent compiler/IDE will be C++11 compliant for core C++11 features. For instance Support For C++11/14/17 Features (Modern C++ with Visual Studio) - https://msdn.microsoft.com/en-us/library/hh567368.aspx

For new C++11 features a quick reference is the Reference section here- http://www.cplusplus.com/reference/
The C++11 items are clearly marked. For example, the new STL array class template - http://www.cplusplus.com/reference/array/array/
@LB
The __cplusplus macro is less useful than it should be.

Compiler support for specific standards is spotty. Both MSVS and GCC have (near) complete support for C++11. All compilers (except maybe Clang) are lacking in support for C++14. C++17 is not yet ratified so all support is provisional/experimental.

The most correct way to figure out what C++ standard(s) your compiler supports is to read the manual.

A good way to move forward is to google "c++ standard support" with the name of your chosen compiler.

Hope this helps.
I may be missing something, but according to this https://gcc.gnu.org/projects/cxx-status.html#cxx11 gcc has full C++14 support since version 6 and support for about half of the confirmed features of C++17.
Unlike earlier versions of the GNU implementation, version 6.1 defaults to -std=C++14
(unfortunately, non-conforming GNU constructs are still enabled without -pedantic-errors).
http://coliru.stacked-crooked.com/a/363623445efaf88c
Last edited on
Well, that shows that it has been more than two months since I last looked at GCC release information.

TDM-GCC is still at version 5.1.
JLBorges wrote:
Unlike earlier versions of the GNU implementation, version 6.1 defaults to -std=C++14
(unfortunately, non-conforming GNU constructs are still enabled without -pedantic-errors).
I thought it defaulted to -std=gnu++14? Either way it seems you're right that -pedantic-errors is still needed even with -std=c++14 - that's unfortunate.
Ok guys thank you for the responses.

So what I'm seeing here from the replies is that C++11 is basically the standard for all modern compilers. A certain amount comply with C++14 and fewer have some provisional support of C++17 which is still in early forms of testing. So the newer versions of C++ are nothing you will ever need to download from a special website to have access to. It appears to all be something that the compiler someone is using will begin to utilize and comply with as new versions become available...provided the programmer is using a modern compiler and downloads the updates. (I am using Xcode so I'm under the assumption it's fairly up to date and will continue to be as new versions of C++ are released)

Does that sum it up pretty well or am I wrong?
Last edited on
Yep, that sounds about right.
Topic archived. No new replies allowed.