From owner-freebsd-hackers@FreeBSD.ORG Tue Nov 25 09:48:29 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1F55216A4CE for ; Tue, 25 Nov 2003 09:48:29 -0800 (PST) Received: from mail.farley.org (farley.org [67.64.95.201]) by mx1.FreeBSD.org (Postfix) with ESMTP id CB0FD43FBF for ; Tue, 25 Nov 2003 09:48:27 -0800 (PST) (envelope-from sean-freebsd@farley.org) Received: from thor.farley.org (p2ptxkj95md3c43n@thor.farley.org [IPv6:2002:4340:5fcd:1::5]) by mail.farley.org (8.12.9p2/8.12.9) with ESMTP id hAPHmQkd061685; Tue, 25 Nov 2003 11:48:26 -0600 (CST) (envelope-from sean-freebsd@farley.org) Received: from thor.farley.org (localhost [127.0.0.1]) by thor.farley.org (8.12.10/8.12.10) with ESMTP id hAPHmQtZ013296; Tue, 25 Nov 2003 11:48:26 -0600 (CST) (envelope-from sean-freebsd@farley.org) Received: from localhost (sean@localhost)hAPHmPdD013293; Tue, 25 Nov 2003 11:48:25 -0600 (CST) (envelope-from sean-freebsd@farley.org) X-Authentication-Warning: thor.farley.org: sean owned process doing -bs Date: Tue, 25 Nov 2003 11:48:25 -0600 (CST) From: Sean Farley X-X-Sender: sean@thor.farley.org To: "Duane H. Hesser" In-Reply-To: <200311220201.hAM21kC15224@mx1.monroe.net> Message-ID: <20031125114606.J12765@thor.farley.org> References: <200311220201.hAM21kC15224@mx1.monroe.net> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: Richard Coleman cc: Jay Sern Liew cc: freebsd-hackers@freebsd.org Subject: Re: integer and long max/min values X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Nov 2003 17:48:29 -0000 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