Hacker News new | past | comments | ask | show | jobs | submit login

Also note that the reason that Rust can get away with not checking for integer overflow while still being memory-safe is because indexing operations are bounds-checked, so an overflowing index variable panics anyway.



> so an overflowing index variable panics anyway.

Unless it overflows all the way to a valid index. Which might lead to unexpected results if the code does not expect to be using a smaller index (for instance, a code trying to access index i+2 might not be expecting it to suddenly access indexes 0 or 1).


But Rust is still memory safe because unsafe code "morally" is unsound if it assumes something like that can't happen.




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

Search: