Re:A bit of background on compilers exploiting signed overflow
by detrino on Sunday May 08, 2016 @02:15PM
(#11655035)
Your loop:
Becomes this with unsigned:
Now if I want to transform my loop to operate on pointers or iterators, the transformation is trivial:
Quick: Do the same for yours.
[ Parent
| on HN ]
Re:A bit of background on compilers exploiting signed overflow
by dsfuoi on Sunday May 08, 2016 @03:05PM
(#11655271)
It looks easy but it isn't.
The second example causes unexpected behavior (and probably ub later) if: min + step > MIN_TYPE_MAX
The last example causes undefined behavior if: max - min < step - 1.