Re: Stupid "warning: declaration of 'index' shadows a global declaration"
Re: Stupid "warning: declaration of 'index' shadows a global declaration"
- Subject: Re: Stupid "warning: declaration of 'index' shadows a global declaration"
- From: Jens Alfke <email@hidden>
- Date: Sun, 15 Nov 2009 08:58:40 -0800
On Nov 15, 2009, at 7:40 AM, Clark Cox wrote:
> I have never encountered a situation where this warning is generated
> that doesn't also generate another error or warning.
I have — Typically it happens when I refactor a function by moving a variable declaration out of an inner block, but for forget to turn the inner declaration into a simple assignment.
{
int foo = ....;
...
if (something) {
int foo = ...; // duh, forgot to delete "int"
...
}
doSomethingWith(foo);
At the doSomethingWith() call, of course foo now doesn't contain any of the changes made in the if() block.
In some (but not all) circumstances the uninitialized-variable warning will catch this, but that warning only works in optimized builds, so if I'm only using the Debug target I won't find it.
—Jens _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden