[EMAIL PROTECTED] (Richard Kenner) writes:
> I found my copy of K&R (Second Edition)....
Robert Dewar <[EMAIL PROTECTED]> writes:
> so in fact the new C standard has changed
> nothing from a definitional point of view,
Wait, though: K&Rv2 is post-C89. If memory serves, it was C89
that established the rule that signed integer overflow has
undefined behavior whereas unsigned overflow is well-defined.
Naturally K&Rv2 documents this, but if you want to know about
traditional practice the relevant wording should come from K&Rv1,
not v2.
I don't know what K&Rv1 says on the subject, but from other
evidence it's clear that common traditional practice assumes wrapv
semantics. I just now looked at the implementation of atoi() in
7th Edition Unix, which is about as traditional as it gets. It
ends as follows:
while(*p >= '0' && *p <= '9')
n = n*10 + *p++ - '0';
return(f? -n: n);
where p is char* and n is int. This relies on wrapv semantics
when atoi returns INT_MIN. I'm sure many similar examples can be
found in the V7 sources.