General-purpose programming language C++ is roughly 37 years old, its first commercial implementation having appeared back in 1985. From the start, the language enjoyed massive uptake among software engineers (by 1990, I had written a few small programs in it, including an interface for a game using the Watcom C++ compiler).
C++ is a powerful programming language, but potentially an intimidating one for newer developers; large hand-coded projects can quickly become exercises in machoism. Given those difficulties, it’s no surprise that early developers embraced Visual Basic and Delphi, which made it easier to work with the language (including drag-and-drop visual components).
Despite attempts to make C++ a little more user-friendly, other programming languages have done their best to crowd it out over the past few decades, at least among commercial developers. This YouTube video shows the changes in programming language popularity from 1965 to 2019 (you can watch C's rise and fall during the years from 1985 to 1998). And yet that didn’t kill the language—far from it, in fact. According to the TIOBE Index, it remains one of the world’s most popular programming languages, powering a variety of legacy apps and new coding. Let’s break down the current state of the language.
The appearance of new C++ versions was a bit haphazard until C++ 11. First there was C++ 2.0 in 1989, then C++ 98 in 1998, C++ 03 in 2003, then C++ 11 in 2011. After that, C++ switched to a regular three-year release cycle, allowing compiler builders to plan development. While anyone can create a C compiler, C++ takes a great deal of effort. We've now had C++ 14, C++ 17, and C++ 20; C++ 23 is in development. A more detailed timeline is available on the official C++ website.
Of these releases, C++ 98 was the first to include the Standard Template Library. C++ 11 was probably the most significant because of the introduction of several significant features including constexpr, move semantics, type inference of variables, initialization, lambda functions, range-based for loops and a number of other features. Type inference meant you could use auto (like var in C#) to simplify declarations and make code easier to understand.
The most recent update was C++ 20, and that includes modules, coroutines, three-way comparison, lambda expressions, consteval and quite a bit more. Many of these changes are refinements; for example, virtual functions can now return constexpr values. Modules are something new that C++ needed for a very long time.
The C++ include system, inherited from C, has still suffered with long compile times, and even with optimizations like pre-compiled headers. Ironically, Borland solved this problem (in Turbo Pascal) back in the 1980s with units. Headers are often compiled multiple times, with templates being compiled for each type; when you use metaprogramming, it can get worse with many template instantiations.
Back in the 1990s, a development technique called 'compiler firewall' used an opaque pointer to cut back on the information passed to the compiler. This made the compilation faster because it eliminated extra includes. Herb Sutter wrote about this back in 2011. It’s worth reviewing a bit of that history if you’re learning the language for the first time, just for the background.
Support for C++ 20 in the big three (gcc, clang and msvc) is pretty good. If you want to see exactly what’s supported and what isn't, this page gives a good breakdown, as well as showing what other compilers support such as Sun/Oracle C++, Intel C++ and Embarcadero CBuilder. Note I use ‘gcc’ to mean ‘gcc or g++’ and ‘clang’ to also mean ‘clang++.’ In both cases, while gcc/clang will compile C++, the ++ versions link with C++ libraries while the rest link with C.
What is C++ Useful For?
The YouTube video earlier showed C++ declining slightly in popularity from its peak in mid-1993. However, the language remains a major programming player in many industries, including finance, information services, and more. The language's creator, Bjarne Stroustrup, recently gave an interview in which he talked about ongoing work on C++ 20 and C++ 23, much of which was delayed by the pandemic.
Many software tools, including compilers, are written in C++. Visual Studio 2012 was 50 million lines of code, the same as Windows Vista (source); nobody is going to rewrite something that size in another programming language, at least not in the near future. While some developers like to position Rust as C++’s eventual successor, that transition is a very long way off, if it ever occurs. To get a full appreciation of what’s in C++ 20, I recommend a read of Oleksandr Koval's page where he provides examples of every new C++ 20 language feature.