* 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.

Thanks,
Ralf

Reply via email to