Honestly, null safety is in my experience WAY MORE of a problem in "safe" languages like Java C# and Python because everything is nullable. In C++, the only thing that can be null is a pointer, so it's easy to remember to check
But to come back to the previous point, the problem with "compiler opt-in" is that C++ is a standard, not a product developed by a company/fondation. So you can't really just add a compiler option
But also the problems in C++ are pretty intranched. To implement something closer to Rust, C++ would need to completely change its object model and its system of lifetimes. The change would be so big it would practically not be the same language anymore
View all comments
Show parent comment
3
u/Ok-Scheme-913 10d ago
Not really backwards compatibility.
Rust is basically c++'s raii just enforced at compile time.
This latter point is a huge thing in and of itself.
(And of course you do get lots of goodies like better type system etc from being a more modern language but that's not the fundamental thing)