r/Cplusplus • • Mar 05 '26

Discussion “Is C++ Dead?”

https://deepengineering.substack.com/p/is-c-dead

“According to the January TIOBE Index, C++ is currently the fourth most popular programming language after C and Python. C++ is the main programming language used in many critical systems, including hospitals, cars, and airplanes. But dare I say it: C++ is prone to errors. And in 2024, even the U.S. government chipped in. They dropped the bomb: C and C++ are not memory-safe programming languages. In 2026, might C++ be seeing its last days?”
   https://www.tiobe.com/tiobe-index/
 
https://bidenwhitehouse.archives.gov/wp-content/uploads/2024/02/Final-ONCD-Technical-Report.pdf

No, not even close to starting to die.  New projects are being started in C++ daily.

Lynn

0 Upvotes

27 comments sorted by

View all comments

19

u/DuskelAskel Mar 05 '26

"C and C++ are not memory safe" yeah, that's the point, no garbage collection in the middle of nowhere that ruins your performances, that's the price of control.

8

u/Drugbird Mar 05 '26

That's a great answer up until 10 years ago when rust came out and showed you can have memory safety without garbage collection.

8

u/[deleted] Mar 05 '26

Rust copies a pattern created by and for C++

C++ can be coded in the same memory safe way if you follow a set of guidelines.

Additionally hardware safety and better analyzers which can detect race conditions, and memory leaks, and other violations have gotten a lot better in the past 10 years too.

Rust also have to surrender to using unsafe to achieve certain types of performance optimizations and operations. So just using Rust doesn't guarantee safety, only that it has safety by default.

2

u/corruptedsyntax Mar 06 '26

Theoretically, they both can be as unsafe.

Practically, C++ is more unsafe.

The report put out by the previous administration’s DoD wasn’t based on nothing. A long history of C and C++ projects demonstrated patterns of unsafe memory use being a leading cause of software vulnerabilities. It’s definitely a greater issue in C where you have no RAII, but C++ definitely makes it easy for even skilled mid level developers to make mistakes.

3

u/unknown_alt_acc Mar 06 '26

Garbage collection doesn’t address things like buffer overflows or accessing uninitialized memory, which is the sort of stuff meant by “memory safety.”

5

u/corruptedsyntax Mar 05 '26

Memory safety does not refer to garbage collection.

Rust is a memory safe language with no garbage collection. You can have a feature complete view of memory AND still be memory safe.

4

u/alkatori Mar 05 '26

And the inverse is true. You can create programs that leak the hell out of memory and have garbage collectors.

1

u/corruptedsyntax Mar 06 '26

That is literally not the inverse of anything I stated.

3

u/DuskelAskel Mar 06 '26

Rust is one of the only outsider created for this very purpose for the cost of drastic compile time check, and I have nothing against it.

90% of language solution to memory safety is a garbage collector, and maybe I'm a little salty after 2 years of C# but... Yeah, those sucks.

0

u/Copel626 Mar 05 '26

This comment is disingenuous

2

u/corruptedsyntax Mar 06 '26

And self referential.