3 ms·
It's not so much "more restrictive" as it is "just plain different." You have behaviors for all four quadrants: there's stuff that's okay in Rust and not okay
by steveklabnik 2y ago
It's not so much "more restrictive" as it is "just plain different."
You have behaviors for all four quadrants: there's stuff that's okay in Rust and not okay in C, stuff that's okay in both, stuff that's not okay in both, and stuff that's not okay in Rust and is okay in C.
- bloppe 2y agoVery curious to know an example of what's ok in Rust but not in C
- whytevuhuni 2y agoOf the things you can do: Integer overflow (wrapping in Rust, undefined behavior in C), indexing out of bounds (panic in Rust, UB in C), unwinding stack frames (runs destructors in Rust, UB in C) Of the things you can try to do, but will be prevented: use-after-free, double-free, using uninitialized variables, null references, modifying constants, data races
- steveklabnik 2y agoThe most straightforward one is that Rust doesn't have strict aliasing.