Strange enum type conversion
Richard Earnshaw
rearnsha@arm.com
Thu Dec 3 15:36:00 GMT 2009
On Thu, 2009-12-03 at 14:40 +0000, Richard Earnshaw wrote:
> > 0xFFFFFFFF (which is an unsigned int)
>
> wrong. That's an int with a bit pattern that's all 1's. On a two's
> complement machine with 32-bit ints that's equivalent to -1.
Forget that. I'm talking nonsense. An int is signed only if it's
smaller than INT_MAX in magnitude. Otherwise it's unsigned (hence
#defining INT_MIN as (-INT_MAX - 1)
R.
More information about the Gcc-help
mailing list