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: Paul Eggert
Subject: Re: [PATCH] time: enforce recent POSIX ruling that time_t is integral
Date: Sun, 10 Oct 2010 14:27:22 -0700
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.12) Gecko/20100915 Thunderbird/3.0.8

On 10/10/2010 02:15 PM, Bruno Haible wrote:
> I disagree that this is enough. The C standard says that a cast to floating-
> point types cannot be portably used in integer constant expressions. But a
> compiler is free to support this, as an extension.

By the same argument, a compiler is also free to support

        struct foo { unsigned int bar : -1 };

as an extension, and therefore none of gnulib's verification code
can possibly work.

Which obviously is not the case.  The C Standard requires a diagnostic
for the above declaration, because the "-1" violates a constraint.
Similarly, the C Standard requires a diagnostic if we replace
"-1" with "1.0", because the requirement that the bitfield width
must be an integral constant expression is a constraint, and
constraint violations must be diagnosed.

If there were a popular nonstandard compiler that accepted these
declarations without complaint, then we'd be in trouble.  But
fortunately for us, that's not the case.



reply via email to

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