Hello Paul,

* Paul Eggert wrote on Sun, Jan 30, 2011 at 12:51:47AM CET:
> --- a/lib/mktime.c
> +++ b/lib/mktime.c

> @@ -45,6 +63,13 @@
>  # define mktime my_mktime
>  #endif /* DEBUG */
>  
> +/* A signed type that is at least one bit wider than int.  */
> +#if INT_MAX <= LONG_MAX / 2
> +typedef long int long_int;
> +#else
> +typedef long long int long_int;
> +#endif

That code doesn't guarantee that long_int is wider than int.  It might
be valid for all production systems, but it's not valid for the Cray
T3E, for example (I'm not sure it had a long long type, but the sizeof
of all smaller integer types was 8).  Now, I don't want to advocate
adding support for museum systems, but just to avoid surprises on new
systems, why not use this:

  #elif defined(LLONG_MAX) && INT_MAX <= LLONG_MAX / 2
  typedef long long int long_int;
  #else
  # error "need a type that is wider than int"
  #endif

Cheers,
Ralf

Reply via email to