[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] Fix char signedness
From: |
Rob Landley |
Subject: |
Re: [Qemu-devel] [PATCH] Fix char signedness |
Date: |
Sat, 28 Oct 2006 15:04:08 -0400 |
User-agent: |
KMail/1.9.1 |
On Saturday 28 October 2006 6:46 am, Martin Guy wrote:
> > gcc on ARM systems default to unsigned. The C standard specifically
> > states that char is either signed or unsigned at the whim of the
> > implementor
>
> Or, more to the point, at the behest of the machine architecture.
> Having to generate code to sign-extend the hard way every time you do
> char-integer promotion if the hardware doesn't do it automatically
> would be long and inefficient, specially since it happens all the
> time.
I'd rather have inefficient than broken. And in general, using "char" as a
small "int" is going to _suck_ on arm. The extra code size more than makes
up for the data size you save if you only have one or two instances of your
data at a time.
Rob
--
"Perfection is reached, not when there is no longer anything to add, but
when there is no longer anything to take away." - Antoine de Saint-Exupery