Is C++ Finished?
The US Government has recommended contractors to no longer use C++. Does this spell doom for the popular programming language?
Recently the US Government recommended its contractors to phase out C++, meaning you probably shouldn’t use it if you’re working for the US government.
They argue C and C++ are insecure.
True enough, some have argued that we’d hardly ever see a bug if it wasn’t for these two languages. It’s very hard to develop a serious C++ program without any bugs. This is in large part because of how these languages allow you to precisely manage memory. The level of control they give you also makes it very easy to make mistakes.
However, if we check the TIOBE index we find C++ has, if anything, grown more popular over the past six years leading up to 2024, not less popular. It’s still almost as popular as it was in 2004.
C++ was developed in 1985 and is basically C with language extensions to support object-oriented programming. The fates of theses two languages are therefore somewhat intertwined, with both capable of doing the same jobs in different ways.
With so many alternatives available to these languages now, we might expect C++ to have got less popular. What’s going on?
It seems some of the rise in popularity of C++ has come at the expense of C.
More and more people are appreciating the object oriented programming paradigm, which even in the 1990s could still seem new and mysterious.
In 2011, and to a lesser extent 2014, C++ was substantially updated, so that post-2011 C++ could almost be regarded as a different programing language to pre-2011 C++.
It’s backwards-compatible for the most part, but C++ now allows programmers to manage memory in ways that are less error-prone.
There are a number of reasons for thinking C++ may well still be one of the most popular programming languages even decades into the future.
It’s important not to underestimate the sheer momentum it has. For a very long time C and C++ were more or less irreplaceable for certain kinds of tasks. If you needed tight real-time memory management, your choices were limited.
This means there is a vast amount of software around that’s written in these languages, and a huge number of programmers who can work with it.
Many of the languages touted as replacements for C and C++ just don’t cut the mustard for all tasks. Java and Python, for example, just don’t allow the kind of real-time memory-management and sheer speed that C++ allows.
These languages really form the bedrock of computing, with most other languages and operating systems being largely written in one or the other, including Python and Java.
Rust enthusiasts have been claiming for a while that Rust will replace C++, but Rust (according to TIOBE) is currently the 14th most popular programming language, whereas C comes in at position 2 on the index, and C is now at position 4.
For Rust to replace C++, vast quantities of code would have to be rewritten, and that’s just not going to happen anytime soon. It’s unclear whether Rust will be around in twenty years; its codebase is small enough that it could almost disappear. More likely, it will at least hang on, in the way that Ruby (which once attracted many absolute fanatics) has done. It may even continue to increase in popularity.
I think Rust will still be around decades into the future. But can Rust replace C++? I just don’t see that happening.
The US Government will struggle to fulfill its needs without resorting to C or C++, even for new projects, and will, I think, be forced into endless compromise.