|
|
|
|
|
by tdbgamer
3043 days ago
|
|
You just have to intentionally use a method on integers called wrapping_add() to explicitly allow overflows. That said I believe overflows are only checked when you compile with the debug target. So when you compile to the release target it doesn't check them I believe. I personally think it's a good thing to only allow overflows when explicitly allowed. |
|
1. overflow is a "program error"
2. If `debug_assertions` are enabled, then overflow must panic
3. If overflow does not panic, then it must two's compliment wrap
This leaves the door open to always requiring a panic someday in the future, if performance gets there.