3 ms·
Where's your proof? Rust has far fewer UB than C yet its performance is comparable to C.
by renox 3y ago
Where's your proof?
Rust has far fewer UB than C yet its performance is comparable to C.
- nindalf 3y agoJust to add, Safe Rust should have zero UB, modulo bugs in the compiler. And they're very serious about fixing such bugs. They won't dismiss it with "just be careful while programming".
- jules 3y agoSure, safe Rust has no UB. The main reason why that doesn't apply to C is that if you wanted to make every C program have a defined behavior, then you also need to define behavior for out of bounds memory writes, including writes from other threads. This means that the compiler basically cannot apply any optimisations, because another thread could be overwriting your data structures at any moment.