|
|
|
|
|
by quotemstr
271 days ago
|
|
> Only in debug builds does it raise a panic. Correctness in debug builds is important, isn't it? That said, panic on integer overflow in debug builds is unfortunate behavior. Overflow should cause an abort, not a panic. > make the performance tradeoff that C++ does and defines signed integer math to wrap 2’s complement In C++, signed overflow is undefined behavior, not wraparound. This property is useful to the optimizer for things like inferring loop bounds. The optimizer has less flexibility in equivalent Rust code. |
|
Personally I would often choose both, overflow panics and also panics abort, so if we overflow we blow up immediately.