On Wed, Aug 20, 2014 at 09:46:48PM +0100, Dominik Vogt wrote:
> On Wed, Aug 20, 2014 at 09:04:41PM +0100, Thomas Adam wrote:
> > Where it's useful, is to acknowledge the fact that the variable is meant
> > to be unused---such as the API used for callbacks, but the callback
> > might not do anything useful yet, etc. Marking variable as unused shows
> > the intent, rather than "I forgot", for instance.
>
> Granted, if we add that it'll be somewhat usefull, but don't expect
> to find any core bugs with it. The function interfaces are clean.
Sure. I'm not expecting it to catch bugs. I'm expecting the programmer
to either take note of it, and use 'unused' or fix it some other way.
> > > ...
> > Sure, I can understand that: -Wno-sign-compare
> >
> > > * Missing initializers are somewhat interesting, but in my eyes
> > > nothing that warrents a warning. It's well defined in C how
> > > fields that are not mentioned in the initializer are filled,
> > > and I see no reason to forbid that. We're not talking about
> > > c++.
> >
> > Well, definitions declared as 'static' will have their default value set
> > appropriately. That's not guaranteed for non-static auto variables.
>
> Oh yes, it *is* guaranteed for auto variables when you initialise
> them:
>
> {
> struct foo = {};
> }
Right, but then you've got block-scoped idioms all over the place. I do
understand how that's useful in some cases, but I'd hate for it to be
the rule, it should be the exception. I do take your point about auto
variables having some value, and in 99% of the cases they're fine left
alone until needed. But when the compiler (GCC) tends to issue that
warning, IME, it's always usually something to take note of, rather than
ignore---whether you've block-scoped something (as in your example),
explicitly, or not.
> At the moment, I'd turn -Wextra on only for the core, removing all
> four classes of existing warnings, i.e.
>
> -Wextra -Wno-unused-parameter -Wno-sign-compare -Wno-type-limits
> -Wno-missing-field-initializers
>
> Then only three warnings in MvwmPager.c remain, and they point to
> real bugs that I'll fix in the separate branch and in fvwm.
Sounds good. Please go ahead and do this. :)
-- Thomas Adam
--
"Deep in my heart I wish I was wrong. But deep in my heart I know I am
not." -- Morrissey ("Girl Least Likely To" -- off of Viva Hate.)