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