3 ms·
> Memory and thread safety properties can be achieved in C++ by operating at a higher level than C with mature, well-debugged, well-optimized libraries. No poin
by saagarjha 7y ago
> Memory and thread safety properties can be achieved in C++ by operating at a higher level than C with mature, well-debugged, well-optimized libraries. No pointers means no pointer errors.
Eh, not to the extent that Rust does. It’s still reasonably easy to get use-after-frees by using a value that has been moved or destroyed.
> Integer overflows are equally possible in Rust and C++. Both offer debug build modes that can watch for those.
In Rust the behavior is defined regardless of signedness.
- ncmncm 7y agoDefined is not the same as correct.
- saagarjha 7y agoBut undefined is the same as incorrect. Any signed overflow in your C or C++ program is a place where you’ve opened yourself up to some quite problematic consequences.
- ncmncm 7y agoYes, just as in Rust. Pretend correctness is not correctness just because it is not UB. I have the same discussion with people who insist unsigned types in C++ or C are safer than signed types because of the UB boogeyman. They only demonstrate their own limited understanding.