basic VRP min/max range overflow question

Robert Dewar dewar@adacore.com
Mon Jun 20 10:54:00 GMT 2005


Robert Dewar wrote:

> That may be your position, but it is not the position of the standard, and
> indeed it is not a well-formed position. Why, because the whole point is 
> that
> when the behavior is undefined, then the change DOES yield a logically
> equivalent behavior, because undefined means undefined, and all possible
> behaviors are logicaly equivalent to undefined.

To add to this, I can see how you might feel that even if the standard
allows this behavior it is non-desirable, but I don't even agree with that.
The trouble is if the compiler makes this "work", then C programmers who
don't really know the language end up depending on it, and writing what
is essentially junk non-portable code. It is a GOOD THING if C programmers
are burned by this and learn the language. It is perfectly possible to
write portable programs in C, but you have to know the language to do it,
and knowing the language means knowing what the actual rules are, not just
being familiar with the behavior of a particular compiler.



More information about the Gcc mailing list