Re: [PATCH 18/348] Fix -Wsahdow warnings

Pedro Alves
2011-11-27T14:55:40Z

On Sunday 27 November 2011 13:52:45, Mark Kettenis wrote:

> What I'm saying is that a local variable shadowing a function is never
> a problem. It would only be a problem if inside the function that has
> the local variable, you'd (accidentally) try to invoke the function.
> That's why I came up with the example:
>
> void foo(void);
>
> void
> bar(void)
> {
> int foo;
>
> foo();
> }
>
> where the function foo() is being called when it is being shadowed by
> a local variable. This won't compile on *any* C compiler, simply
> because it isn't legal C.
>

Unless the variable is a function pointer.

--
Pedro Alves