Why chars unsigned on 3B?
Dick Dunn
rcd at opus.UUCP
Wed Jun 6 12:29:31 AEST 1984
>Is it true what I have heard, there are instructions on the 3B to
>implement signed chars easily? If so, why are chars unsigned in C?
Because someone is trying to drive home the fact that you shouldn't program
in a way that depends on whether chars are signed! :-)
Seriously, why not have chars unsigned by definition on this machine?
There's one particular problem - we've gotten a mess somewhere in the long
path from concept to implementation: Char not only means a character; it
means an 8-bit quantity. (I know - where does it say that? I'm talking
practice here.) So in a sense, when you mean "signed 8-bit integer" you
say "char" on most machines. If you mean "unsigned 8-bit integer" you say
"unsigned char". But how do you say "signed 8-bit integer" on the 3B? You
get frustrated, kick the terminal, and end up in a cast. I wish that
tradition hadn't gotten us into this corner...
--
Dick Dunn {hao,ucbvax,allegra}!nbires!rcd (303)444-5710 x3086
...Never offend with style when you can offend with substance.
More information about the Comp.lang.c
mailing list