Why chars unsigned on 3B?

trt at rti-sel.UUCP trt at rti-sel.UUCP
Tue Jun 12 03:43:53 AEST 1984

Some compilers make chars signed, others make them unsigned.
I wonder if any choose randomly (:-)).
I suppose there are some interesting language questions involved here
but the major effect is to slow down program porting.

A "solution" to the signed/unsigned char problem:
One of the niftier features of the Gould UTX port
is that the compiler can generate code to emulate either signed
or unsigned chars.  That is, "cc foo.c" generates
code for signed chars (VAX-like) whereas "cc -XU foo.c"
generates unsigned code (Amdahl-like).

The default code is VAX-like for the obvious reason.
Programs that were written on, say, a 68K should probably be compiled '-XU'.
Hack though it be, it sure does save time.

By the way, our Gould Concept needs two instructions to sign-extend a byte.
However, in usual cases (e.g. while(*p++ = *q++);) the sign-extension
is not required and is not generated.
	Tom Truscott

More information about the Comp.lang.c mailing list