Re: Please don't do this (code fragment)
>>"elf" == elf <elf@florence.buici.com> writes:
elf> We aren't writing about unsigned arithmetic.
Since you seem to be protesting about people not being nice
and constructive, a few points of common courtesy called nettiquette:
a) Do not quote 85 lines to add only one of yours
b) Do not post your comment on the top followed by quoted material
below that.
To answer your dismissive nit: Overflow is a special case of
integer arithmetic (did you not express interest in INT_MAX +1? What
kind of expression do you think it is?). Given that the standard does
not speak directly of the result of overflow (except to say that it
results in undefined behaviour for signed integral values), any
insight into how integers need be implemented sheds light on the
issue.
Incidentally, looking at the behaviour of the left shift
operator, as defined by the standard, once does come to the
conclusion that the behaviour looks awful like two's complement.
The standard does not say that integer overflow needs be a
trap. Yes, in an example, it does mention that integer overflow may
result in undefined behaviour, but then, Annex H of c99 casually
mentions:
======================================================================
Annex H (informative) Language independent arithmetic
H.2.2 Integer types
The signed C integer types int, long int, long long int, and the
corresponding unsigned types are compatible with LIA-1. If an
implementation adds support for the LIA-1 exceptional values
``integer_overflow'' and ``undefined'', then those types are LIA-1
conformant types. C's unsigned integer types are ``modulo'' in the
LIA-1 sense in that overflows or out-of-bounds results silently
wrap. An implementation that defines signed integer types as also
being modulo need not detect integer overflow, in which case, only
integer divide-by-zero need be detected.
======================================================================
So there are these two non-normative references to integer
overflow that are inconclusive when taken together.
For some one irritated by people not being constructive, you
are remarkably curt when people provide information that you
(incorrectly, IMHO) think is not germane.
Pot. Kettle. Black.
manoj
--
The world needs more people like us and fewer like them.
Manoj Srivastava <srivasta@debian.org> <http://www.debian.org/%7Esrivasta/>
1024R/C7261095 print CB D9 F4 12 68 07 E4 05 CC 2D 27 12 1D F5 E8 6E
1024D/BF24424C print 4966 F272 D093 B493 410B 924B 21BA DABB BF24 424C
Reply to: