3 ms·
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-
by kibwen 4y ago
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.
- cesarb 4y ago> 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).
- iudqnolq 4y agoBut Rust is still memory safe because unsafe code "morally" is unsound if it assumes something like that can't happen.