3 ms·
> smart pointers, almost everything return by value and sanitizers All of these have runtime costs. What you describe is C++ forcing you to practice defensive
by nequo 3y ago
> smart pointers, almost everything return by value
and sanitizers
All of these have runtime costs. What you describe is C++ forcing you to practice defensive programming in order to avoid costly debugging sessions.
Rust’s borrow checker lets you avoid some of that runtime cost. You can pass around references much of the time without wrapping them in smart pointers. You don’t have to reference count and don’t have to malloc and free as much. And while bounds checking will be on, you can avoid some of those sanitizers too.
You would get this benefit even if all code was unsafe in the libraries that you use, which of course it isn’t.