integer and long max/min values
Sean Farley
sean-freebsd at farley.org
Tue Nov 25 09:48:29 PST 2003
On Fri, 21 Nov 2003, Duane H. Hesser wrote:
> 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.
>
> 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.
To get the latest version (5.1a) of enquire:
http://homepages.cwi.nl/~steven/enquire.html
Sean
-----------------------
sean-freebsd at farley.org
More information about the freebsd-hackers
mailing list