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

Chuck Meade chuckmeade at mindspring.com
Wed Nov 30 23:41:32 UTC 2005


> > > Exactly.  It sounds like a good approach might be eliminating the
> > > warnings when the chars are being used as string or character data,
> >
> >  char c;
> >
> >  if (c > ' ') ...
> >
> > Does this count as "used as character data"?
> >
> > Cases like this will fail when the 8th bit is set...
> 
> Ok, in that case c is a char, and anything in single quotes is a char literal, 
> and any release version of compiler that warns when you compare a char 
> variable with a char literal is so _amazingly_ brain damaged that no mocking 
> I can manage could possibly be sufficient.  It doesn't matter whether the 8th 
> bit is set or not because they're the SAME TYPE.
> 
> Deeply, deeply screwed up...
> 
> Rob

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.

Chuck





More information about the busybox mailing list