Jeff Trawick wrote:
>
> INT_MAX must be the maximum value for type int. You can't have
> INT_MAX be 32767 if the values for int range from -2billion to
> +2billion.
No one said that, AFAIK.
>
> An int must be at least a 16-bit integer. That is why INT_MAX must be
> at least 32767.
>
ANSI says nothing about bits however. All I'm saying is that we
can't make the "assumption" that signed ints go from -2B to +2B
because ANSI doesn't allow that. ANSI says all you can assume is
that they go from -32k to +32k (+/-). Making any kind of assumptions
on bit sizes can lead to trouble. If you need a *guaranteed* larger
range, it's up to the program to determine the right type:
#if INT_MAX <= 32767
typedef bigrange_t long
#else
typedef bigrange_t int
#endif
In practicle, real-world matters, I doubt if the assumption that
ints are +/- 2B will bite us at all.
--
===========================================================================
Jim Jagielski [|] [EMAIL PROTECTED] [|] http://www.jaguNET.com/
"Hell is hot, that's never been disputed by anybody."