News for hackers. Stuff that matters.
Re:Catching integer overflows in C by cpeterso on Wednesday August 22, 2018 @01:10AM (#17816462)
Rust specifies that both signed and unsigned integer overflow will wrap as two’s complement. The Rust developers want to discourage overflow because it is a common source of logic bugs, but the behavior is not unsafe.

https://huonw.github.io/blog/2016/04/myths-and-legends-about...

Re:Catching integer overflows in C by saagarjha on Wednesday August 22, 2018 @02:28AM (#17816765)
What I was trying to say is that it's kinda odd to me that code behaves differently debug and release builds–to me it seems like it could make it easy to write code that works in one configuration but is subtly broken, without realizing the issue, because the programmer was complacent about checking which build they were using. Changing behavior based on whether hardware traps are available makes it even worse. I see how it's not "unsafe" in the usual sense (e.g. memory corruption), but I really would prefer an all-or-nothing overflows just don't or overflows always trap (usually with a way to override this for specific computations, either for performance or for properties of 2s complement arithmetic).