Re:Signed Integers Are Two’s Complement
by lloda on Thursday May 31, 2018 @02:41AM
(#17194409)
The link is an outdated version r0, this is r2 (don't know if it's the latest) http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p090...
[ Parent
| on HN ]
The main change between [P0907r0] and the subsequent revision is to maintain undefined behavior when signed integer overflow occurs, instead of defining wrapping behavior.
Re:Signed Integers Are Two’s Complement
by badsectoracula on Thursday May 31, 2018 @06:04AM
(#17195180)
Gah, what is the point then?
The point is that signed integers are two's complement. After all, it is the title.
Naive overflow checks are often done by adding two positive numbers together and checking if the result is negative. If wrapping is undefined, this no longer works, and the overflow check may be eliminated.
And the joy I originally had is once again lost.
You can always get the most up-to-date public version using wg21.link/pxxxx. So for this proposal: https://wg21.link/p0907