[LC++]Smallest int -2147483648 or -2147483647?
Paul Gearon
gearon at ieee.org
Wed Sep 4 19:01:05 UTC 2002
> > int const minInt = 0x80000000;
>
> Will this work across all architectures?
Obviously this only works for 32 bit architectures. A more generic line
might be:
int const minInt = 1 << (sizeof(int) * 8 - 1);
> Ie my understanding is that different architectures implement
> negatives in slightly differing ways.
I don't know of any architectures that don't use 2's complement, but I've
been wrong before...
Regards,
Paul Gearon
More information about the tuxCPProgramming
mailing list