Proof positive the "signedness of char *" warning is useless.

Rob Landley rob at
Thu Dec 1 15:24:22 UTC 2005

On Wednesday 30 November 2005 17:41, Chuck Meade wrote:
> Yeah that one can't be warned against by the compiler.  It is just an
> error -- assuming the user wasn't purposely aiming for this behavior.
> In other words, if they wrote the above code using a signed char,
> and did not handle (or prevent) the case where the MSB would get set,
> and they are surprised when the comparison gives unexpected results,
> then the error is on their part.

Ok, so some of the most common _real_ errors aren't caught by this stupid 
warning (and can't be), so even herculean efforts to clean up the noise 
wouldn't actually be _useful_.

But what _might_ be useful is -funsigned-char added to our makefile.  (The 
argument about this producing more or less efficient code still sounds like 
handwaving at this point.  I'm more concerned about whether or not our code 
is _right_.  We declare unsigned char in a lot of places already, if that 
affected the binary size I think we would have noticed by now.  As for 
efficiency, either the library has assembly optimized versions of strcmp() 
and friends, or it doesn't.)

*rummage* *rummage*...

I just set EXTRA_CFLAGS_OPTIONS to -funsigned-char and did a "make clean && 
make" and it seems to have built (on ubuntu with gcc 3.3) just fine.  I'll 
try it on gcc 4.0 in a bit and see if it makes a difference to the darn 
warnings, and if so I'll patch Rules.mak and check it in to see what breaks 
for other people.

I'm going to try to put together a -pre2 for release wednesday the 7th.  It 
probably won't have all the bugs from the list fixed, but I hope to at least 
have 'em triaged into "must fix for 1.1", "would be nice", and "not a 1.1 

> Chuck

Steve Ballmer: Innovation!  Inigo Montoya: You keep using that word.
I do not think it means what you think it means.

More information about the busybox mailing list