News for hackers. Stuff that matters.
Re:Catching integer overflows in C by saagarjha on Wednesday August 22, 2018 @12:51AM (#17816393)
That's the issue: while x86 exposes such operations, not all assembly dialects do. They too have to support C and emulating overflow detection in software would be unreasonable.
Re:Catching integer overflows in C by acqq on Wednesday August 22, 2018 @02:12AM (#17816705)
It seems to me that it would not be unreasonable. If you need that detection, you need it at any price, on any platform. If you don't need it, meaning, the code doesn't test it, the compiler has still the right to optimize it away.
Re:Catching integer overflows in C by saagarjha on Wednesday August 22, 2018 @02:30AM (#17816775)
So it would be implementation defined behavior. I'm fine with that; personally, I think the standard was too quick to assign "undefined" here. But it can't mandate a certain behavior in the standard across all platforms.