Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 25 Nov 2003 11:48:25 -0600 (CST)
From:      Sean Farley <sean-freebsd@farley.org>
To:        "Duane H. Hesser" <dhh@monroe.net>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: integer and long max/min values
Message-ID:  <20031125114606.J12765@thor.farley.org>
In-Reply-To: <200311220201.hAM21kC15224@mx1.monroe.net>
References:  <200311220201.hAM21kC15224@mx1.monroe.net>

next in thread | previous in thread | raw e-mail | index | archive | help
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@farley.org



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