Subject: Re: unsigned chars (was Re: Possible bug in arm32 strongarm optimisations.)
To: None <port-arm32@netbsd.org>
From: Dave Daniels <dave_daniels@argonet.co.uk>
List: port-arm32
Date: 10/28/2000 11:24:44
In article <00102700275503.02765@pinky>,
Chris Gilbert <chris@buzzbee.freeserve.co.uk> wrote:
> Just cos I'm a curious bunny and it's not in the FAQ, but why do we use
> unsigned chars as the default for chars?
I would say that it is because the ARM processor prior to the
StrongARM did not have a 'load byte and sign extend' instruction.
Signed char would have been quite expensive because every load of
a char would have had to have been of the form:
LDRB R0,[<whatever>]
MOV R0,R0,LSL#24
MOV R0,R0,ASR#24
Personally I prefer char to be unsigned. I suspect that signed
char became the norm because ASCII only has codes in the range 0
to 127 so the eighth bit, the sign bit, was not an issue for the
Americans who designed C.
Dave Daniels