In 2023, the White House issued a memo recommending a shift to "memory-safe" programming languages. NSA and CISA recommendations followed. The tech press erupted with "C++ is dead" headlines. The usual comment-section arguments ensued.
If you write C++, you probably had one question: is this a real threat, or just more hype?
Let's break it down — no panic, no language zealotry.
Where This Came From
In February 2024, CISA (US Cybersecurity and Infrastructure Security Agency) together with partners from the UK, Australia, and several other countries published a joint guide: "Prioritizing Memory Safety." The core thesis: most critical vulnerabilities — buffer overflow, use-after-free, race conditions — stem from manual memory management. C and C++ are named as examples of "memory-unsafe" languages.
This isn't the first warning. According to Microsoft, ~70% of CVEs in Windows over the past 10 years are memory safety issues. Google cites similar numbers for Chrome. Chromium is ~25 million lines of C++.
Why now? Several converging factors:
- Rust has matured and landed in the Linux kernel (2022) and Android (since 2021).
- High-profile attacks (Log4Shell, SolarWinds) keep software security in the spotlight.
- Governments are treating software like critical infrastructure — with corresponding requirements.
What's Actually Happening in Industry
It's important to separate two questions: "Is C++ being displaced as a language?" and "Are new things being written in something else?"
New low-level code — yes, not only C++ anymore
Google started writing new Android components in Rust in 2021. By 2023, around 21% of new native Android code is written in Rust. Memory-related vulnerabilities in Android dropped from 76% to 24% of total CVEs over that period.
Microsoft is experimenting with Rust in Windows kernel components. Amazon wrote parts of Firecracker VMM and AWS Nitro components in Rust.
This is significant. But the scale matters: these companies continue to maintain tens or hundreds of millions of lines of C++ code. Nobody is rewriting their codebase from scratch.
Existing C++ code — isn't going anywhere
Chrome is 25 million lines of C++. That won't be rewritten. Unreal Engine, Unity (C++ core), Qt, LLVM, MySQL, PostgreSQL, virtually all gamedev — that's all C++. Fintech (latency-critical trading systems) too.
The question isn't "rewrite or not" — it's "for what new projects should you consider an alternative?"
Rust: Real Strengths and Honest Limitations
Rust genuinely solves a class of problems that in C++ requires discipline and tooling (ASan, TSan, Valgrind, code review).
What Rust does well:
- The ownership model eliminates use-after-free and double-free at the compiler level.
- The borrow checker prevents data races in multithreaded code.
- Good interoperability with existing C code via FFI.
Where it gets complicated:
- Steep learning curve — especially for developers accustomed to C++.
- The C++ ecosystem is incomparably richer: Boost, Qt, game engines, graphics APIs.
- Unsafe Rust exists — and in systems code you can't avoid it. Guarantees weaken.
- Compile times are slower than even large C++ projects.
- Generics and the trait system are powerful but structured differently. Relearning is painful.
Notably: in the 2023 Stack Overflow survey, Rust was the "most loved language" for the 7th year in a row. But "used at work" — only ~9% of developers. The gap between admiration and actual adoption is large.
C++ Isn't Standing Still
Critics of C++ often compare modern Rust against C++98. That's not a fair comparison.
C++23 and C++26
C++23 is already ratified. Key improvements:
std::expected<T, E>— error handling without exceptions or error codes, close to Rust'sResult.- Ranges v3 — safer and more expressive than raw loops.
std::print/std::println— finally, formatted output without UB.- Improvements to span and view — fewer raw pointers.
C++26 (in progress) brings Contracts (P2900). Pre/post-conditions and invariants directly in the language. Allows catching violations in debug mode, with the ability to disable checks in release.
Safety Profiles (WG21 P3081)
WG21 is actively working on a "Safety Profile" — a set of rules that can be applied to a codebase to statically guarantee the absence of certain UB. The idea is similar to Rust's approach, but as annotations and checks layered on existing C++.
Not a silver bullet, but a signal that standardizers hear the criticism and are responding.
The Real Cost of Migration
Suppose you want to rewrite a C++ system in Rust. What does that actually cost?
Google, per internal estimates, cites a ratio: 1 line of Rust ≈ 2–3 lines of C++ in effort when writing from scratch. For rewrites — even higher, because you need to understand the old code and express its invariants in a new type system.
Microsoft studied the costs of porting critical Windows components. Conclusion: for mature C++ code with good test coverage, this is a multi-year project with high regression risk.
Real case: Firefox rewrote its CSS/layout engine (Stylo) in Rust — it took several years, dozens of engineers, and yielded real performance gains. But this was a specific subsystem, not the entire browser.
Takeaway: gradual replacement of new components is realistic. Full migration of legacy code is economically impractical in most cases.
What This Means for You as a Developer
If you already write C++:
- Your knowledge isn't going anywhere. C++ dominates in gamedev, systems programming, finance, embedded — and will for another 10–20 years.
- Learn modern C++ (C++20/23). Many of the problems C++ gets criticized for are already addressed in the new standard.
- Invest time in understanding ownership, RAII, smart pointers — it's good practice in C++ and a mental bridge to Rust.
If you're considering learning Rust:
- It's a valuable skill, especially if you're interested in systems programming, OS development, WebAssembly.
- Don't expect Rust to "replace" C++ in your niche anytime soon — but in certain new projects it's already a first-class choice.
In interviews:
- "Why is C++ still relevant?" is a real question. Knowing about the memory safety debates, C++23/26, and the real-world deployment of Rust signals a mature understanding of the market.
Summary
C++ isn't being replaced. It's being criticized — fairly. The industry is looking for ways to write new code more safely, and Rust has earned a significant place in that search. But this isn't the death of C++ — it's its maturation.
The world's largest codebases are written in C++. They won't be rewritten. The language itself is actively evolving. And a developer who understands both C++ and why this entire safety conversation exists in the first place — is worth more.
Want to dig deeper into memory safety in C++ — practically, with code examples and typical interview mistakes? This is covered across several topics in our interview simulator.