M
Michael Press
Right. We've argued that because it happens to be true. See C99
6.2.5p9:
A computation involving unsigned operands can never overflow,
because a result that cannot be represented by the resulting
unsigned integer type is reduced modulo the number that is one
greater than the largest value that can be represented by the
resulting type.
Informally, it's reasonable to refer to what happens when the result
of an unsigned operation won't fit in the target type as "overflow".
The point is that the standard very specifically *doesn't* refer
to it as "overflow".
If you don't like the way the standard uses, or doesn't use,
the term "overflow", that's fine. I'm not sure I like it myself.
All I'm doing is pointing out what the standard actually says.
There is little to like or dislike. The usage and
definitions are well established and effective.
Overflow only matters for 2's complement arithmetic.
C is carry out of the high bit of a word.
R is carry into the high bit of a word.
O is overflow.
O = C ^ R
Consider four bit words.
_
ADD 1000 1111 -> 0111 C R V
_
ADD 0100 0100 -> 1000 C R V
_ _ _
ADD 0100 0011 -> 0111 C R V
_
ADD 1100 1100 -> 1000 C R V
_
NEG 1000 -> 1000 C R V
When the bit patterns are interpreted as unsigned integers
only carry matters.