Re: __TIME_MIN/__TIME_MAX

From: Jacques A. Vidrine (nectar_at_FreeBSD.org)
Date: 11/16/03

  • Next message: Jacques A. Vidrine: "Re: __TIME_MIN/__TIME_MAX"
    Date: Sun, 16 Nov 2003 06:52:30 -0600
    To: Bruce Evans <bde@zeta.org.au>
    
    

    On Sun, Nov 16, 2003 at 11:36:41PM +1100, Bruce Evans wrote:
    > Actually, it's implementation-defined if time_t is integral (doesn't
    > matter if it is signed or unsigned) (and the value is not representable).
    > It's only undefined if time_t is a floating type.

    Are you certain? I'll have to double-check. I thought that if a type
    was signed, then attempting to assign an out-of-range value was
    undefined (similar to overflow with signed types).

    >
    > > All I really want to do is correct a parsing bug and at the same time
    > > eliminate a warning so that I can set WARNS?=1 in libc before the code
    > > freeze.
    >
    > You can safely assume that it won't change to floating before the code
    > freeze :-).

    Heh. Until a few hours ago, I was pretty sure that no one would dare
    make any changes to time_t this late in the game, but then the sparc64
    time_t thread sprouted. :-)

    > I think (t = n) would cause compiler warnings at higher WARNS levels
    > if time_t were unsigned. `t == n' certainly would.
    > `(long)(time_t)n == n' could be used (this is like the above except it
    > doesn't use a temporary variable. However, the cast to long breaks the
    > warning about the bug that if n is -1L and time_t is unsigned long, then
    > the comarison will succeed on 2's complement machines although time_t
    > cannot represent -1.

    The actual warning was of the `comparison always true' variety.
    Annoying, but it did lead me to see that there was a (mostly harmless)
    bug in strptime.

    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"
    

  • Next message: Jacques A. Vidrine: "Re: __TIME_MIN/__TIME_MAX"