__TIME_MIN/__TIME_MAX
Jacques Vidrine
nectar at freebsd.org
Fri Nov 14 20:57:56 PST 2003
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 at celabo.org jvidrine at verio.net nectar at freebsd.org nectar at kth.se
More information about the freebsd-arch
mailing list