Date: Fri, 14 Nov 2003 22:58:00 -0600 From: Jacques Vidrine <nectar@freebsd.org> To: Bruce Evans <bde@zeta.org.au> Cc: freebsd-arch@FreeBSD.org Subject: Re: __TIME_MIN/__TIME_MAX Message-ID: <3FB5B258.6010207@freebsd.org> In-Reply-To: <20031115114906.L11453@gamplex.bde.org> References: <20031114194119.GA94198@madman.celabo.org> <20031115114906.L11453@gamplex.bde.org>
next in thread | previous in thread | raw e-mail | index | archive | help
Bruce Evans said the following on 11/14/03 6:54 PM:
> I prefer the cast.
Actually, so do I :-) MIN/MAX values won't work for removing some (IMHO
stupid) warnings emitted by GCC. So this kind of thing OK?
long n;
time_t t;
errno = 0;
n = strtoul(...);
if (errno == ERANGE || (long)(t = n) != n)
/* out of range */;
> It doesn't require nonstandard infrastructure that
> would need to be maintained forever, and works even better for floating
> point too (assuming a C99 compiler, but not in reality in FreeBSD :)
> (min/max checks don't work right for floating point because precision
> may be just as important as range).
Good points, thank you. Cheers,
--
Jacques Vidrine NTT/Verio SME FreeBSD UNIX Heimdal
nectar@celabo.org jvidrine@verio.net nectar@freebsd.org nectar@kth.se
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3FB5B258.6010207>
