Re: Please don't do this (code fragment)
I'm not sure if we are talking about the same thing. There is nothing
I can find in the standard that guarantees that (int) MAX_INT + 1 < 0.
There is a description of type conversion, but that doesn't talk about
overflow behavoir for arithmetic. If you wish your words to be
believed, please provide a reference.
On Tue, Jan 15, 2002 at 02:34:38PM -0800, Thomas Bushnell, BSG wrote:
> elf@florence.buici.com writes:
>
> > According to every reference I have found, there is no stipulation
> > that integers be implemented using two's complement notation. IIRC,
> > some of the Cray computers represented integers with a sign bit. I
> > doubt the claim.
>
> You don't read very well. What I said originally was:
>
> Actually, the C standard does essentially guarantee two's complement
> arithmetic. It specifies integer overflow behavior and
> signed/unsigned conversion behavior exactly.
>
> So a machine can do its arithmetic some other way, but it has to make
> it seem to the programmer that it's always two's complement.
>
> Note carefully the distinction between implementation and appearance
> to the programmer.
>
> Further posts on the thread have corrected my faulty memory; not quite
> as much is specified as I thought. (In particular, overflow behavior
> is not specified.) But signed/unsigned conversion *is* so specified.
>
> Thomas
Reply to: