This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]