gcc on ARM systems default to unsigned.  The C standard specifically
states that char is either signed or unsigned at the whim of the
implementor

Or, more to the point, at the behest of the machine architecture.
Having to generate code to sign-extend the hard way every time you do
char-integer promotion if the hardware doesn't do it automatically
would be long and inefficient, specially since it happens all the
time.
This has been a problem since the "All the world's a VAX" days, the
classic boob being

char c;
while ((c = getchar()) != EOF) {
    ...
}

of course, 255 always != -1 so it loops forever.
Check how many of your C primers get this wrong!
The flipside of that boob is that on a signed char architecture, the
loop will exit prematurely when it meets a 255 character.

These days instead, all the world's a 386 and anything different is broken...

24-bit integers, anyone? :)

  M


_______________________________________________
Qemu-devel mailing list
Qemu-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/qemu-devel

Reply via email to