I can’t see a post about Rust or C++ without comments about Rust replacing C++. I’ve worked in Rust as a cybersecurity intern at Microsoft and I really enjoyed it. I’ve also worked extensively in C++ in both research applications and currently in my role as a machine learning engineer at Google. There is a ton of overlap in applications between the two languages, but C++ isn’t going anywhere anytime soon.
This is important to understand because the internet likes to perpetuate the myth that C++ is a soon-to-be-dead language. I’ve seen many people say not to learn C++ because Rust can do basically everything C++ can do but is much easier to work with and almost guaranteed to be memory safe. This narrative is especially harmful for new developers who focus primarily on what languages they should gain experience in. This causes them to write off C++ which I think is a huge mistake because it’s actually one of the best languages for new developers to learn.
C++ is going to be around for a long time. Rust may overtake it in popularity eventually, but it won’t be anytime soon. Most people say this is because developers don’t want to/can’t take the time to learn a new language (this is abhorrently untrue) or Rust isn’t as capable as C++ (also untrue for the vast majority of applications). In reality, there’s a simple reason Rust won’t overtake C++ anytime soon: the developer talent pool.
Most applications that use C++ are latency and efficiency critical. In my experience, this criticality is responsible for the profitability of the application. Two examples where C++ is frequently used are machine learning and high-frequency trading applications. Both require efficient, low-latency execution to achieve a profit.
You might think: So what? Rust can be used here too. And it absolutely can be. But the developer talent pool for C++ is much larger than Rust. Companies utilizing C++ are the same companies that tend toward a higher hiring bar because they need knowledgeable developers that are able to be productive quickly. A larger hiring pool is a great aid in this effort. Choosing C++ over Rust makes sense just to have a larger pool of potential employees to pick from. Sure, a company can hire C++ developers and teach them Rust, but that’s a hit on developer velocity which these companies need to avoid.
I bring this up because the “Rust has killed C++” narrative can have a very negative impact on individual software developers. C++ is one of the best languages for new developers to learn for two primary reasons:
It forces an understanding of fundamentals. Fundamentals are important to learn and they lay the groundwork for a developer to learn other languages. Going from C++ to another language is easy but the other way can be a bit more difficult. I’d like to emphasize here that part of the job of a software engineer is to be able to pick up languages required for the problem they’re trying to solve. C++ is helpful for learning this skill.
C++ is incredibly lucrative. The roles looking for excellent developers to tackle latency-critical problems tend to pay well. As a new developer, learning C++ puts you in a great position for a lucrative career.
I recommend dabbling in C++. Even though I’d like to program in Rust because it's very enjoyable, there’s a ton of friction for new language adoption especially in profit-critical applications. C++ isn’t going anywhere anytime soon.