------- Comment #8 from rearnsha at gcc dot gnu dot org  2009-02-10 15:21 
-------
Opinions vary wildly as to which warnings should be on by default, and which
should be part of whatever bundle.

I personally agree that shadowing variables is generally bad practice, but you
then have to be wary when porting code because you can end up shadowing things
that come from a library (different standard libraries contain all sorts of
wild and wacky variables or functions, most of which you'll never care about). 
For example:

#include <stdio.h>

int f()
{
  int printf = 3; return printf;
}

will generate a warning if compiled with -Wshadow (ok, that's somewhat
perverse, since every library has printf, but it makes the point).


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31693

Reply via email to