One interesting thing about my C++ course is that the instructor never specified which standard he is using for the course. There are many standards in the C++ universe, and they don’t all have the same functions.

Originally, when I attempted to build my game without specifying a standard, it failed to build. So a little research led me to an article that gave me the idea to try the 2011 standard by adding “-std=c++11” to my build script. Since that worked, I erroneously thought that the course must use the (now old) 2011 standard instead of the newer 2014 or 2017 standards. Turns out I was wrong.

By default, my compiler will compile with the 1997 standard. How do I know this? Well, try this command:

$ g++ -dM -E -x c++ /dev/null | grep -F __cplusplus

Here was the output:

#define __cplusplus 199711L

Then, watch what happens when I specify a standard to use:

alaskalinuxuser@alaskalinuxuser-OptiPlex-7010:~$ g++ -std=c++11 -dM -E -x c++ /dev/null | grep -F __cplusplus
#define __cplusplus 201103L
alaskalinuxuser@alaskalinuxuser-OptiPlex-7010:~$ g++ -std=c++1z -dM -E -x c++ /dev/null | grep -F __cplusplus
#define __cplusplus 201500L
alaskalinuxuser@alaskalinuxuser-OptiPlex-7010:~$ g++ -std=c++14 -dM -E -x c++ /dev/null | grep -F __cplusplus
#define __cplusplus 201402L

So, when I specify a standard, it uses that standard, when I don’t it tries to compile with the 1997 standard, which is really outdated! I’m not sure why they set the default to such an old standard. Obviously, my compiler is new enough for the 2014+ standards:

alaskalinuxuser@alaskalinuxuser-OptiPlex-7010:~$ g++ –version
g++ (Ubuntu 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO

Even still, my compiler is a bit out of date. It’s 2018 and the newest I can use is the completed 2014, or the pre 2017 (which reads 2015, as that was the latest available when my compiler was put together).


In any event, it would appear that my course can compile and run just fine on the newest standard available to my compiler, so the course material must not be that old. However, since it will fully compile on the 2011 standard, it must have been written before 2014, or not use any of the 2014 functions.

Interesting. Very interesting….

Linux – keep it simple.

2 Replies to “Which C++ standard is it, anyways?”

Leave a Reply

Your email address will not be published. Required fields are marked *