Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 21 Nov 2003 09:53:50 -0800
From:      <Vijay.Singh@nokia.com>
To:        <kientzle@acm.org>, <liew@jaysern.org>
Cc:        freebsd-hackers@freebsd.org
Subject:   RE: integer and long max/min values
Message-ID:  <4D7B558499107545BB45044C63822DDE02C094C1@mvebe001.americas.nokia.com>

next in thread | raw e-mail | index | archive | help
Write a simple C program to ++ an int or long variable and see when it =
overflows.

> -----Original Message-----
> From: owner-freebsd-hackers@freebsd.org
> [mailto:owner-freebsd-hackers@freebsd.org]On Behalf Of ext=20
> Tim Kientzle
> Sent: Friday, November 21, 2003 12:24 AM
> To: Jay Sern Liew
> Cc: freebsd-hackers@freebsd.org
> Subject: Re: integer and long max/min values
>=20
>=20
> 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 <limits.h>
>=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
>=20
> _______________________________________________
> freebsd-hackers@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
> To unsubscribe, send any mail to=20
> "freebsd-hackers-unsubscribe@freebsd.org"
>=20



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