On 11/07/2010 11:11 PM, Ian Lance Taylor wrote:
C99 6.2.5 paragraph 9 says "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."

In the C++0x draft I have, 3.9.1 paragraph 4 says "Unsigned integers,
declared unsigned, shall obey the laws of arithmetic modulo 2**N where n
is number of bits in the value representation of that particular size of
integer."

So I don't think unsigned arithmetic can overflow in C/C++.

Ah, so I was missing something, thanks!

Jason

Reply via email to