News for hackers. Stuff that matters.
Re:Signed Integers Are Two’s Complement by rom1v on Thursday May 31, 2018 @02:33AM (#17194375)
size_t is unsigned, overflow is defined.
Re:Signed Integers Are Two’s Complement by JdeBP on Thursday May 31, 2018 @05:54AM (#17195153)
The type of index is, however, signed int.
Re:Signed Integers Are Two’s Complement by rom1v on Thursday May 31, 2018 @06:07AM (#17195186)
You're right, I read diagonally :)

However, the optimization argument for signed overflow seems weird to me, because I can't see any reason why this argument would not apply to unsigned overflow as well.

If we keep undefined behavior to optimize things like "if (n < n + 1)" when n is signed, why not do the same when n is unsigned?

Conversely, if there is a good reason not to, then why would it not apply to signed overflow as well?