On 10/30/2013 03:03 PM, David Brown wrote:
Technically speaking, casting your signed values to unsigned and using that to detect overflow will not necessarily work - I think it would be "implementation defined". But almost all architectures use two's compliment arithmetic, and it will work there.
We defined it to be bit-pattern-preserving as a GCC extension, anyway. -- Florian Weimer / Red Hat Product Security Team