[net.arch] Complement Arithmetic, -0 as tag vs unsigned

henry@utzoo.UUCP (Henry Spencer) (02/12/84)

Guy Harris observes:

  If -(2^(word size - 1)) were treated as an "unitialized variable" tag on a
  twos-complement machine, that would mean that you would need signed and
  unsigned add/subtract instructions; the bit pattern (1 shifted_left word_size-1)
  is a valid unsigned number in the middle of the valid range of unsigned
  numbers, so it shouldn't cause a trap...

My own theory is that the right answer to this one, given a decent word
size (e.g. 32 bits; 16 isn't enough), is to throw out unsigned numbers.
They originated as a way to squeeze one more bit of integer magnitude
out of an excessively-small word.  Eliminate the excessively-small word
and you eliminate the requirement for unsigned integers.  You do have
to worry about pointer arithmetic, but with a big word there is really
no harm in declaring "negative" pointers illegal as well.  In fact, this
is probably valuable error checking.

Doing this means we need only one kind of integer arithmetic and can
do complete overflow checking with trap on overflow.  And we can treat
the largest negative two's-complement number specially if we want, without
causing any problems.  Bitwise operations have to get special treatment,
but since they are defined as operating on *all* the bits of their
operands there is nothing that can be done about them without adding tag
bits or something similar anyway.
-- 
				Henry Spencer @ U of Toronto Zoology
				{allegra,ihnp4,linus,decvax}!utzoo!henry