Subject: Re: char is unsigned... wow
To: Cliff Neighbors <cliff@allegronetworks.com>
From: Todd Whitesel <toddpw@best.com>
List: port-macppc
Date: 08/02/2000 22:33:32
> well. that must have made porting somewhat annoying?
Not really; portable programs have NEVER been allowed to assume that 'char'
was signed. A careful reading of K&R and ANSI references will confirm it.
This is just one of those dumb things about C that people simply do not
expect, because so much else in C makes incredibly perfect sense...
> OK for your trouble you avoid one (sign extension) instruction
> when you operate on a char.
That is _precisely_ why it is done.
PowerPC compilers are pretty consistent about doing this because (a) PowerPC
does not have a signed 8-bit load (argh!!) and (b) the C language allows it.
Todd Whitesel
toddpw @ best.com