On (15 Jul 97) Bob Stout wrote to Cameron Clark...
BS> Yeah, but the code in question determines whether a numer is
BS> negative or not by testing the high bit. On a 1's complement
BS> machine (yes, there are such beasts and they do have C
BS> compilers), it will fail.
I don't think so - the high bit is set for negative numbers on a 1's
complement machine, just like it is on a 2's complement machine. It
should also work on a sign-magnitude machine.
However, it would fail on a machine that used biasing, like the
exponents of most floating point numbers.
As I understand things, the current C9X proposal includes a requirement
for 1's complement, 2's complement or sign-magnitude. I've never
actually heard of a machine that used biasing for integers. Obviously
none of this would work on a decimal machine, but the C standard
requires a "pure binary" representation for ints. I haven't tried to
check this in the C++ standard, but I believe its requirements are
probably closer to those of C90 than C9X.
Later,
Jerry.
... The Universe is a figment of its own imagination.
--- PPoint 1.90
---------------
* Origin: Point Pointedly Pointless (1:128/166.5)
|