- To: slug@xxxxxxxxxxx
- Subject: [SLUG] -Wshadow
- From: Benno <benjl@xxxxxxxxxxxxxxx>
- Date: Tue, 24 May 2005 22:33:22 +1000
- User-agent: Mutt/1.5.6+20040907i
Ok, so we all know enabling warnings are a really good idea. But what
do people think about -Wshadow?
It helps catch badness like this:
int foo(int x)
{
int y = 0;
{
int y;
y = 12;
}
return y;
}
But also causes stuff like this:
int __str;
#include <foo.h>
which has
int bar(int __str);
in it. Which is probably not really a bug.
It also catches things like using "int index" as a variable, which shadows
the builtin index function.
Anyway, moral of the story is, I'm thinking that -Wshadow is not so good, since
it causes more spurious warnings that it helps save.
Does anyone want to convince me otherwise?
Cheers,
Benno