Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Very curious to know an example of what's ok in Rust but not in C


Of 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


The most straightforward one is that Rust doesn't have strict aliasing.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: