Feature - Compiler version Cross Reference

I have adapted the various tables from the GNU compiler pages and cross referenced the features on this page. If a feature does not seem to work, checking this page for support is the equivalent of asking the question "Is it plugged in?"

Links to get a copy of the standard

At the moment, the most up to date copy of the ISO document (at least that is publicly available and "free") is this one from the Open Standards group.

A note about the code examples

Unless otherwise credited, all the code examples are my own, taken/adapted from running production code. It would be harder to steal a product ten lines at a time, than it was for Johnny Cash to steal a car one part at a time. I feel that real world examples work best.

Sample Pre-processor Check for Compiler Version

If you are worried about backward compatibility, you may want to consider something like this apprach.

15 //---
16 // Which version of g++ is being used?
17 //---
18 #ifndef GCC_VERSION
19 #define GCC_VERSION (__GNUC__ * 10000 + \\
                        __GNUC_MINOR__ * 100 + \\
20 #endif
22 //---
23 // As an example, the C++ keyword nullptr is not present in 
   // 4.5.x and earlier. 
24 //---
25 #if GCC_VERSION < 40600
26 #ifndef nullptr
27 #define nullptr (NULL)
28 #else
29 #ifdef nullptr
29 #error nullptr defined somewhere as a MACRO. You need to fix it.
30 #endif
31 #endif

An explanatory word about these commentaries

The latest specfication of C++ is called C++11, and it was approved in early April of 2011. It is a 1325 page PDF that not too many programmers are going to bother to read. In fact, the features have been dribbling in for quite some time, and some of them are already supported in the latest edition of the GNU compiler. These features vary in their degree of familiarity.

There is an overview of the changes provided as a table (Currently in work: mouseover explanations for the sometimes oddly worded GNU explanations), with dates that the support became available. This site looks at some of the new features in greater depth and explains how you might find them useful in practical, commercial C++ programming. Where it is practical and needed I have supplied examples from my own coding.

The index of the expanded features/articles is below. For bookmarking purposes, the permalinks will remain constant or "const" if you prefer, but I will periodically realphabetize the list so that things don't get lost. The articles are being written as the topic comes up.

Each topic has its own page. I warn the reader that are are probably some cut-and-paste errors that may prevent excerpted code from compiling -- particularly with features not yet implemented in GNU g++ 4.5. As I find them, I will fix them.

The article on the new meaning of auto was the first article written, it is an improvement you will probably want to use, and I suggest taking a look at it to get a feel for the tone of voice and content of this information.