Brendan Simon. wrote
> I am a big PowerPC fan but I would like to know the reasoning behind the
> Linux/PPC people choosing unsigned char as the default char type.  Why go
> against the convention ?  I hope there is a really good reason that will help
> progress the C programming environment to better things.

I'm told for ARM it is a performance issue.  I've handled dozens of
these on the ARM port.  In almost all of them it is a getc/getchar
that is being coerced down to a char before being checked agains EOF.

getc and getchar are (int) functions, EOF is an int.  You can't cast
down to a char until you know you have a character and not an EOF.

Code with downcasts before checking EOF will fail one way on PPC and ARM
and the opposite way anytime it encounters a (char)255 in its input
stream.

Fortunately some wise soul extended the ARM compiler to print a warning
when a `char' is compared to a negative constant.  We collect these during
the builds and list them over at...
        http://www.federated.com/~jim/arm/charhell.html
... there are only about 150 packages left with this problem.  
There are still packages like gnome-pim that can't be detected by the
compiler, but anytime a program hangs or fails to read a file this is
the first thing to look for on the ARM port.

I'll write a little script to blow all the compiler detected problems
into the BTS.  We'll see how many we can get cleaned up.

-- 
                                     Jim Studt, President
                                     The Federated Software Group, Inc.

Reply via email to