This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Autoconf manual's coverage of signed integer overflow & portability

Paul Eggert wrote:
Andrew Pinski <> 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
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.

And replace it with what?

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]