From owner-freebsd-hackers@FreeBSD.ORG Fri Nov 21 10:48:55 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 121A616A4CE for ; Fri, 21 Nov 2003 10:48:55 -0800 (PST) Received: from gandalf.online.bg (gandalf.online.bg [217.75.128.9]) by mx1.FreeBSD.org (Postfix) with SMTP id 11A1F43FBD for ; Fri, 21 Nov 2003 10:48:53 -0800 (PST) (envelope-from roam@ringlet.net) Received: (qmail 27830 invoked from network); 21 Nov 2003 18:47:20 -0000 Received: from office.sbnd.net (HELO straylight.ringlet.net) (217.75.140.130) by gandalf.online.bg with SMTP; 21 Nov 2003 18:47:20 -0000 Received: (qmail 78911 invoked by uid 1000); 21 Nov 2003 18:31:54 -0000 Date: Fri, 21 Nov 2003 20:31:54 +0200 From: Peter Pentchev To: Vijay.Singh@nokia.com Message-ID: <20031121183154.GC74629@straylight.m.ringlet.net> Mail-Followup-To: Vijay.Singh@nokia.com, kientzle@acm.org, liew@jaysern.org, freebsd-hackers@freebsd.org References: <4D7B558499107545BB45044C63822DDE02C094C1@mvebe001.americas.nokia.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="ZwgA9U+XZDXt4+m+" Content-Disposition: inline In-Reply-To: <4D7B558499107545BB45044C63822DDE02C094C1@mvebe001.americas.nokia.com> User-Agent: Mutt/1.5.5.1i cc: liew@jaysern.org cc: freebsd-hackers@freebsd.org cc: kientzle@acm.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: Fri, 21 Nov 2003 18:48:55 -0000 --ZwgA9U+XZDXt4+m+ Content-Type: text/plain; charset=windows-1251 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Nov 21, 2003 at 09:53:50AM -0800, Vijay.Singh@nokia.com wrote: [format recovered; Tim Kientzle wrote:] > > Jay Sern Liew wrote: > > > how do I find out the maximum (and minimum) value a long=20 > > and int will hold > > > in C? (before it overflows or underflows) > >=20 > > #include > >=20 > > INT_MAX and INT_MIN are the max/min values for an int > > LONG_MAX and LONG_MIN are the max/min values for long. > >=20 > > Also, see stdint.h, which is defined in C99. > >=20 > > Also, buy a good C reference book. ;-) > >=20 > > Tim Kientzle [..and Vijay Singh wrote:] >=20 > Write a simple C program to ++ an int or long variable and see when it > overflows. Why, after Tim actually quoted the exact header file to include and the exact constants to use? G'luck, Peter --=20 Peter Pentchev roam@ringlet.net roam@sbnd.net roam@FreeBSD.org PGP key: http://people.FreeBSD.org/~roam/roam.key.asc Key fingerprint FDBA FD79 C26F 3C51 C95E DF9E ED18 B68D 1619 4553 You have, of course, just begun reading the sentence that you have just fin= ished reading. --ZwgA9U+XZDXt4+m+ Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.3 (FreeBSD) iD8DBQE/vloa7Ri2jRYZRVMRAl72AKDGCKzTnSF6z12N6N+zBzd+BuzfwQCgoVXH 7NSGIvkBuGaiSy3KQqvNE6Q= =zyOP -----END PGP SIGNATURE----- --ZwgA9U+XZDXt4+m+--