[PATCH] Document arithmetic overflow semantics
Robert Dewar
dewar@gnat.com
Thu Feb 13 19:08:00 GMT 2003
> What do you mean by this, exactly? Java is defied as having signed
> two's complement arithmetic.
At the implementation level, the difference between signed and unsigned
arithmetic (for operations like plus and minus) is in whether overflow
is an issue or not (look for example at the MIPS). The issue of "2-s complement"
just has to do with how you interpret a bit pattern (i.e. whether all 1's is
a big number of minus one). If you have wrap around semantics, then, regardless
of how you choose to interpret the bit patterns, the appropriate run-time
representation of add/subtract operations is to do unsigned adds with no
carry around (and no signed overflow detection).
More information about the Gcc
mailing list