[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    RE: Proof positive the "signedness of char *" warning is useless.
From:       "Chuck Meade" <chuckmeade () mindspring ! com>
Date:       2005-11-30 23:41:32
Message-ID: IIEEICKJLNEPBBDJICNGKEOOJFAA.chuckmeade () mindspring ! com
[Download RAW message or body]

> > > 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


_______________________________________________
busybox mailing list
busybox@busybox.net
http://busybox.net/cgi-bin/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic