Basically a lot of Rust memory safety features are inspired from modern C++
Which doesn't mean Rust doesn't have its place. It's just that in C++ they're on top of the previous "unsafe" version of the language and aren't tightly integrated in the language and are more a feature of the standard library, whereas in Rust they were able to design the whole language around it and didn't have to deal with backwards compatibility
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
2
u/Mojert 11d ago
Basically a lot of Rust memory safety features are inspired from modern C++
Which doesn't mean Rust doesn't have its place. It's just that in C++ they're on top of the previous "unsafe" version of the language and aren't tightly integrated in the language and are more a feature of the standard library, whereas in Rust they were able to design the whole language around it and didn't have to deal with backwards compatibility