bug-gnulib
[Top][All Lists]
Advanced

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

Re: mktime() hangs for dates before 1970


From: Paul Eggert
Subject: Re: mktime() hangs for dates before 1970
Date: Sun, 30 Jan 2011 11:19:09 -0800
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.13) Gecko/20101208 Thunderbird/3.1.7

On 01/30/2011 10:20 AM, Ralf Wildenhues wrote:
>> +verify (long_int_is_wide_enough, INT_MAX == INT_MAX * (long_int) 2 / 2);
> This doesn't make sense to me.  If long_int has the same width as int,
> then the right hand side overflows thus invokes undefined behavior.

No, because this is a constant expression.
The C Standard requires compilers to diagnose constraint violations,
and one of the constraints is that constant expressions must
not overflow.  So a diagnostic is required here, which is all
that we can ask from "verify".

Would it be clearer if we did this instead?

verify (long_int_is_wide_enough, INT_MAX * (long_int) 2);

This would be just as good from the technical point of view.



reply via email to

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