3 ms·
Just to record the difference. Unsigned and signed overflow in rust are both well defined to do one of two things, panic or wrap. If debug assertions are enabl
by gpm 9y ago
Just to record the difference.
Unsigned and signed overflow in rust are both well defined to do one of two things, panic or wrap. If debug assertions are enabled they are defined to panic. In practice if debug assertions are not enabled they will wrap, but I believe that is technically subject to change (into a panic). It will realistically only change if the hardware gets much better at catching overflows quickly.
A panic is usually like a exception that you are really not expected to ever catch except at thread boundaries. You can turn them into a immediate process exit with a compiler flag.
- mmirate 9y ago> except at thread boundaries Also at FFI boundaries. (i.e. a panicky Rust function, supplied to foreign code as a callback)
- steveklabnik 9y ago> I believe that is technically subject to change Yes, that's correct.