News for hackers. Stuff that matters.
Re:GCC undefined behaviors are getting wild by lilllly on Monday November 28, 2022 @06:33AM (#33772339)
I can easily test if n+1 is < n with fwrapv.

Without you have to do convoluted things like rearranging the expression to unnatural forms (move the addition to the right but invert to subtraction, etc), special case INT_MAX/INT_MIN, and so on - which you then have to hope the compiler is smart enough to optimize, which it often isn't (oh how ironic).

There are no comments on this comment yet.