Which C++ standard is it, anyways?

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.

Geany: the little IDE that could!


Recently, while working with some older equipment, I needed a lightweight java IDE to compile some java projects. I really wasn’t looking for something quite as big as eclipse or netbeans, I just wanted a simple, one stop solution that would allow me to build java programs on an older laptop.

So, I rubbed a magic lamp, and out popped Geany!

Well, more specifically, the laptop is running Debian Wheezy, and had openJDK already installed. With that alone, I could have built java programs from the command line, but it can get a little tedious. So, I looked on the repositories for an IDE that wasn’t too large.

Thus enter Geany. I first used Geany a long time ago as a text editor on #! (CrunchBang) Linux, but revisiting the program revealed that I was not using it to it’s full potential. Specifically, you can compile, build, and run various program types from within Geany. Of course, it only outsources the commands for you, so you need a java jdk in order to compile java, or a c++ compiler to compile c++. Geany just does all the command line work for you.

What Geany does accomplish for you, however, is a great user interface with templates and the ability to organize projects or view code with different filters. As you can see in the picture, I was testing out Logic Crazy’s Alpha Beta Chess program.

As well as showing you the code, it can do parenthesis highlighting, colors for different code type, and a class and method tree on the side. It really is a great program if you need a lightweight IDE. I know that I’ll be putting it to good use.

Linux – keep it simple.