integer and long max/min values
Duane H. Hesser
dhh at monroe.net
Fri Nov 21 17:59:48 PST 2003
On 21-Nov-2003 Richard Coleman wrote:
> Jay Sern Liew wrote:
>
>> how do I find out the maximum (and minimum) value a long and int will hold
>> in C? (before it overflows or underflows)
>>
>> if it's compiler-dependent, then does anyone know where I can find the GCC
>> documentation for stuff like that?
>
> It will be architecture dependent (32 or 64 bit machines?). I doubt the
> GCC docs talk about this. You might check Richard Steven's book on
> "Advanced Unix Programming". It covers lots of information about
> standard machine limits and how to discover them.
>
> Richard Coleman
> richardcoleman at mindspring.com
>
>
As a point of interest, there is a file
/usr/src/contrib/gcc/enquire.c
in the distributed sources which, when compiled and run, will
report the max and min values of short, long, int, float, etc.
along with various sizes and alignments.
--
----------------------------------
Just be glad Microsoft doesn't make passenger airplanes.
Duane H. Hesser <dhh at monroe.net>
----------------------------------
More information about the freebsd-hackers
mailing list