autoconf-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Paul Eggert
Subject: Re: Autoconf manual's coverage of signed integer overflow & portability
Date: Tue, 02 Jan 2007 22:45:27 -0800
User-agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.4 (gnu/linux)

Andrew Pinski <address@hidden> 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

[Prev in Thread] Current Thread [Next in Thread]