Re: __TIME_MIN/__TIME_MAX

From: Jacques Vidrine (nectar_at_freebsd.org)
Date: 11/15/03

  • Next message: Garance A Drosihn: "64-bit time_t on sparc64, epilogue(?)"
    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"
    

  • Next message: Garance A Drosihn: "64-bit time_t on sparc64, epilogue(?)"

    Relevant Pages

    • Re: STM32 ARM toolset advice?
      ... GCC Generates quite good code for the ARM these days. ... linux libraries for the TRITON boards, is that floating point operations ... I did find that an AT91SAM7S at 16Mhz using the IAR libraries, ...
      (comp.arch.embedded)
    • Re: Richard Stallman is responsible for the shrinking economy
      ... Nobody wrote: ... their users might actually care. ... gcc doesn't do this at *any* optimisation level; ... But I suspect everyone to have some skeletons in the closet for floating ...
      (comp.arch.embedded)
    • Re: File
      ... I m afraid this question may be very stupid. ... of course I can not use 'bitN' because floating point numbers ... I need to use 'bitN' and not double. ... 'bitN' for a MATLAB format" and also "You must store double precision ...
      (comp.soft-sys.matlab)
    • Re: converting an unsigned 64 bit in a FPU double
      ... answer is simply to see how gcc does it, ... That expects to load a floating point value. ... extended uint64_to_extended(uint64_t u64) ...
      (comp.lang.asm.x86)
    • Re: c compilation - gcc vs visual c
      ... deficiency in gcc. ... I try a switch in my program which deploys a different floating ... This algorithm is ... I will try to create a simpler test program to represent the above ...
      (comp.lang.c)

  • Quantcast