Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 21 Nov 2003 17:59:30 -0800 (PST)
From:      "Duane H. Hesser" <dhh@monroe.net>
To:        Richard Coleman <richardcoleman@mindspring.com>
Cc:        Jay Sern Liew <liew@jaysern.org>
Subject:   Re: integer and long max/min values
Message-ID:  <200311220201.hAM21kC15224@mx1.monroe.net>
In-Reply-To: <3FBE2C57.6070200@mindspring.com>

next in thread | previous in thread | raw e-mail | index | archive | help

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@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@monroe.net>
----------------------------------



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200311220201.hAM21kC15224>