-fsigned-char on all arches
Rob Landley
rob at landley.net
Wed Apr 11 15:17:48 PDT 2007
On Wednesday 11 April 2007 8:42 am, Will Newton wrote:
> Hi all,
>
> I noticed there was a change here:
>
>
http://www.busybox.net/cgi-bin/viewcvs.cgi/trunk/uClibc/Rules.mak?rev=13205&r1=13200&r2=13205
>
> that enabled -fsigned-char for all arches. What was the reasoning
> behind this decision? I'm reliably informed that it generates
> suboptimal code on our architecture.
Because when it varies it's a source of bugs, and we got tired of hitting
them. (And yes, we hit them.)
You can specify "signed char" or "unsigned char" when you declare them, and
lots of places do. But gcc 4.x produces warnings whenever things "differ in
signedness", and filling the code with typecasts to make this shut up would
make the code brittle and unreadable and eventually introduce new bugs
(because that thing you're typecasting to (signed char) got turned into an
unsigned int elsewhere and all the references that produced an error or
warning were fixed up, but the typecast prevents this one from
complaining...)
BusyBox chose -funsigned-char because we liked being 8-bit clean. (Makes
things like UTF-8 a whole lot easier). But tinycc won't work if you build it
with -funsigned-char, which also means it won't work if you build it on an
architecture that defaults to -funsigned-char (arm, for example). I haven't
tracked down the problem there yet...
Which architecture are you referring to?
Rob
--
Penguicon 5.0 Apr 20-22, Linux Expo/SF Convention. Bruce Schneier, Christine
Peterson, Steve Jackson, Randy Milholland, Elizabeth Bear, Charlie Stross...
More information about the uClibc
mailing list