bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] time: enforce recent POSIX ruling that time_t is integral


From: Bruno Haible
Subject: Re: [PATCH] time: enforce recent POSIX ruling that time_t is integral
Date: Sat, 9 Oct 2010 21:22:34 +0200
User-agent: KMail/1.9.9

Hi Eric,

Thanks for this addition.

> +struct __time_t_must_be_integral {
> +  unsigned int __floating_time_t_unsupported : 2 * ((time_t) 1 / 2 == 0) - 1;
> +};

I agree with the expression (personally I would have used  (time_t) 0.5 == 0
but that's probably equivalent).

But why use __ as prefix? Symbols starting with __ are, generally speaking,
in the territory of the implementation (libc + compiler), which is why gnulib
tries to use only symbols that start with a single _.

> Hmm, given Bruno's recent point that C89 didn't require ?: support
> in constant expressions, should we re-visit verify.h to use
> (2 * cond - 1) instead of (cond ? 1 : -1)?

Currently it seems that all compilers support both. Therefore there is no
reason to change (cond ? 1 : -1) to (2 * cond - 1), but there is also no
reason to change it in the opposite direction.

Bruno



reply via email to

[Prev in Thread] Current Thread [Next in Thread]