[Top][All Lists]

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

Re: mktime() hangs for dates before 1970

From: Ralf Wildenhues
Subject: Re: mktime() hangs for dates before 1970
Date: Sun, 30 Jan 2011 20:51:10 +0100
User-agent: Mutt/1.5.20 (2010-08-04)

* Paul Eggert wrote on Sun, Jan 30, 2011 at 08:19:09PM CET:
> 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".

Ah, sorry, I wasn't aware of the constraint violation bit.

> Would it be clearer if we did this instead?
> verify (long_int_is_wide_enough, INT_MAX * (long_int) 2);

Naah, with that I think the current code is fine.


reply via email to

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