Tugger the SLUGger!SLUG Mailing List Archives

[SLUG] -Wshadow


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