Re: __TIME_MIN/__TIME_MAX
From: Jacques Vidrine (nectar_at_freebsd.org)
Date: 11/15/03
- Previous message: Matthew D. Fuller: "Re: newfs and mount vs. half-baked disks"
- In reply to: Bruce Evans: "Re: __TIME_MIN/__TIME_MAX"
- Next in thread: Bruce Evans: "Re: __TIME_MIN/__TIME_MAX"
- Reply: Bruce Evans: "Re: __TIME_MIN/__TIME_MAX"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 14 Nov 2003 22:58:00 -0600 To: Bruce Evans <bde@zeta.org.au>
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 _______________________________________________ freebsd-arch@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-arch To unsubscribe, send any mail to "freebsd-arch-unsubscribe@freebsd.org"
- Previous message: Matthew D. Fuller: "Re: newfs and mount vs. half-baked disks"
- In reply to: Bruce Evans: "Re: __TIME_MIN/__TIME_MAX"
- Next in thread: Bruce Evans: "Re: __TIME_MIN/__TIME_MAX"
- Reply: Bruce Evans: "Re: __TIME_MIN/__TIME_MAX"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|