The C and C++ versions

The C language appeared in 1972 and the C++ language in 1985. Since then, many features (Especially in C++) has been added. The versions of the language C are named with the letter 'C' followed by two digits representing the year the version has been introduced (The year 1999 version of C: C99, the 2011 version: C11). The C++ versions are named similarly (1998 version: C++98, 2011 version C++11).

Not every compiler supports all versions of the C/C++ languages. Obviously, a compiler supporting only up to the version C++11 does not support the features introduced by the versions above (Example, C++17 and C++20). That should not stop us from taking advantage of the new features of the C/C++ languages as popular compilers usually have a great support of modern versions of C/C++. However, if we want our code to be portable, we usually should avoid, for compatibility reasons, versions that are too recent (Example, not even 1 year old).

In this course, a note is written when a feature introduced in the C++11/C11 versions or above is presented.

Often, compilers can be configured to compile using one of the language versions they support. Specifying the version it uses can be useful if, by default, it does not use the most recent version it supports or if we want to use an older version to make sure that our code is compatible with that version.

Here is, from Code::Blocks, an error message, because the code includes a file of the Standard Library, added in the version C++11, while the compiler is configured to use the version C++98:

The following pages show how to configure the C and C++ version used, with some IDEs.