Andrew Pinski <[EMAIL PROTECTED]> writes:

> Let me make the point that signed overflow has been undefined since
> before the C standard was finialized and in fact there is a nice
> paper/book called "C Traps and Pitfalls[2]" which mentions all of this
> back in 1988.

C Traps and Pitfalls, like K&Rv2, is derived from a draft of the C89
standard and was intended to match the final C89 standard closely.  It
is therefore not a reliable source of information about traditional C.

K&Rv1 is a better source, and as David Daney reports in
<http://gcc.gnu.org/ml/gcc/2006-12/msg00948.html>
it said that integer overflow handling was machine-dependent
and that all existing implementations ignored overflows.
This corresponds to existing practice at the time,
which was that signed overflow wrapped; but clearly
there was an attempt to allow other implementations.

Compiler writers have been trying to drag C users away from C's
traditional wrapping semantics ever since C89 came out, but they
haven't been all that succesful yet.


Reply via email to