From owner-freebsd-hackers@FreeBSD.ORG Fri Nov 21 17:59:48 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 81B2616A4CE for ; Fri, 21 Nov 2003 17:59:48 -0800 (PST) Received: from smtp2.monroe.net (smtp2.monroe.net [63.117.144.14]) by mx1.FreeBSD.org (Postfix) with SMTP id 8AEF143FE5 for ; Fri, 21 Nov 2003 17:59:43 -0800 (PST) (envelope-from dhh@monroe.net) Received: from mx1.monroe.net (mx1.monroe.net [63.117.144.20]) by smtp2.monroe.net (8.12.8/8.12.5) with ESMTP id hAM1qbdG007816; Fri, 21 Nov 2003 17:52:37 -0800 Received: from chevy.androcles.com (63-117-146-58.monroe.net [63.117.146.58]) by mx1.monroe.net (8.11.6/8.11.2) with ESMTP id hAM21kC15224; Fri, 21 Nov 2003 18:01:46 -0800 Message-Id: <200311220201.hAM21kC15224@mx1.monroe.net> X-Mailer: XFMail 1.5.4 on FreeBSD X-Priority: 3 (Normal) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit MIME-Version: 1.0 In-Reply-To: <3FBE2C57.6070200@mindspring.com> Date: Fri, 21 Nov 2003 17:59:30 -0800 (PST) From: "Duane H. Hesser" To: Richard Coleman cc: freebsd-hackers@freebsd.org cc: Jay Sern Liew Subject: Re: integer and long max/min values X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: dhh@monroe.net List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Nov 2003 01:59:48 -0000 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 ----------------------------------