Main image of article The Future of C++

Even as it approaches 40 years old, C++ remains one of the world’s most successful programming languages. It's likely that you've used applications written in C++ such as Chrome and Firefox browsers, many compilers, MongoDB, Photoshop, OpenOffice, MySQL, and many games engines and most AAA games. If you’re a developer, knowledge of C++ can open up all kinds of opportunities.

Bjarne Stroustrup, the creator of C++, lists many more C++ applications on his website. By all indications, the language is also future-proof, with developers using it to create applications for virtual reality (VR) via the Unreal Engine, the Internet of Things (IoT), and cryptocurrency applications. This Developer Nation Survey from Q3 2021 shows 7.5 million developers use C/C++.

However, desktop development (one of the key channels for C++ development) has been declining in popularity in the last few years compared to web and mobile development. According to this University of Florida infographic, of the top 20 US Computer Science departments, C++ is only taught in two of them. Is C++ finally losing strength?

C++ is Complicated

If you've ever browsed websites like the C++ FAQ, you'll know how complicated C++ can be; I know a lot of C++ but I never mastered template metaprogramming, for example. With earlier versions of the language, a comma in the wrong place could produce hundreds of compile errors. From C++ 11 on, the language improved (for instance, move semantics for changing ownership and rvalue references), but there is still a steep learning curve.

C++ has regained some popularity since C++ 11 appeared and the term Modern C++ was coined for it. Microsoft has a page describing the features that make up Modern C++.

Developing a New Application

Back in the 90s, if you were developing a major desktop application, C++ would likely be your first choice. When Java came along, it quickly became the language to use for business applications, leaving low-level and system programming to C++. C# came about after Microsoft had a legal tussle over using Java.

In 2006, Microsoft introduced C++/CLI, which was C++ for .NET; for .NET, you now had a choice of C++, C# or VB.NET. But C++/CLI did not set the world on fire; it is still available in Visual Studio 2022, but I don't know anybody who uses it.

In recent years, we’ve seen the rise of newer programming languages that could replace C++ for low-level system stuff, including Rust, which offers safety and security by eliminating buffer overflows and memory leaks (and is a lot easier to learn than C++).

There is a belief held by some that the past use of C and C++ has led to a continual stream of vulnerabilities in applications and it's time to increase software safety by using safer languages like Rust. Mark Russinovich, the CTO of Microsoft Azure and founder of SysInternals, tweeted last year: “It's time to halt starting any new projects in C/C++ and use Rust for those scenarios where a non-GC language is required.”

But in spite of all that, C++ is still going strong. Do not expect it to vanish soon.  Any major project that used C++ is not going to rewrite it into another language; it’s doubtful that they could justify the time or expense for that.

C++ Going Forward

Along with the release of C++ 11 came a shift to a three-year release cycle with improvements and new features in C++ 14, 17 and 20. Compiler writers take time to implement these new features ,but you can see what is supported on this compiler support page. GCC and Clang usually lead the pack with Intel’s and Microsoft’s compilers snapping at their heels. I think it’ll be a year or two more before these compilers fully support C++ 23 and of course there’s C++ 26 and C++ 29 plotted on the official status page.

Conclusion

Rust is not an immediate threat to C++, as it's still too new and there aren’t that many Rust jobs yet… but expect that to slowly change. Nonetheless, I’d bet that C++ will be around for decades to come, especially given the sheer amount of legacy code out there.