IsUnsigned() function?

Karl Heuer karl at haddock.ima.isc.com
Tue Jul 31 08:47:03 AEST 1990


In article <1990Jul30.162449.19240 at kfw.COM> will at kfw.com (Will Crowder) writes:
>Side note: can anyone out there give a good explanation as to why
>chars were *ever* signed in the first place,

The pdp11's byte-to-word instruction did sign extension, so it was cheaper to
have chars be signed.  Since ASCII fits in the intersection of signed and
unsigned char, most of the problems were hidden.

>and why ANSI decided not to require either signed or unsigned chars (leaving
>it implementation dependent)?

Because which one is cheaper is an implementation-dependent issue, and, since
most programs don't care (because they don't use char objects as arithmetic
quantities), there was no reason to impose an undue burden on them.

I think the real mistake was in having `char' do triple duty: it's the atomic
text object (for which signedness shouldn't even be an askable question; cf.
Pascal), the allocation quantum (probably should have been spelled `byte'),
and a small integer type (which should be spelled `short short int').

Karl W. Z. Heuer (karl at kelp.ima.isc.com or ima!kelp!karl), The Walking Lint



More information about the Comp.lang.c mailing list