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

Rob Landley rob at landley.net
Fri Dec 2 15:47:21 UTC 2005


On Thursday 01 December 2005 23:13, John Z. Bohach wrote:
> On Thursday 01 December 2005 15:13, Rob Landley wrote:
> > My complaint was that any legitimate warnings were getting buried in the
> > noise of all the char * warnings.
> >
> > The "signedness of int" warnings are a lot more legitimate, because
> > that's a signedness that was always well defined.
>
> All such warnings are "legitimate."  If a function asks you to pass to it a
> signed parameter, and you pass it an unsigned one, be warned.  If its
> intential, cast it, so its obvious that the type mismatch is intentional.

No.

Period.

> If its not intentional, fix it to match the prototype.

It does match the prototype.  The prototype is "char".  The signedness of that 
was indeterminate.

Now it's specifying -funsigned-char.  It is now determinate.

> You've taken the position that because nothing is obviously broken by
> sign-mismatched parameters being passed, its okay to do so.

I take the position that gcc has not warned about this for the past 15 years 
and it was never previously a problem, and this wouldn't be the first warning 
GCC introduced that had 10 times as much noise as signal.

> It is not 
> okay, even though most of the time you can get away with it, and most of
> the time compilers don't warn about it.

You are welcome to think anything you want, and I am welcome to put you in my 
spam filter as I would anything _else_ that produces 10x as much noise as it 
does signal.

> Now, the current situation is that gcc has reached a level of maturity (or
> the gcc developers had nothing better to do) that allows it to warn about
> sign mismatches.  I applaude that.

Did I disable the warning?  Or did I define the sign of char?

> Yes, C is a weakly-typed language, else 
> such mismatches would cause compile-time errors and your code wouldn't even
> compile.

If gcc broke the build due to something like this, I would consider it broken 
and simply wouldn't support it until they fixed it.

> I admit to being a purist, but damn it, computing requires, nay, 
> demands, perfection.

The perfect is the enemy of the good.

You are now in my spam filter.

Go away.

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