• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Stupid "warning: declaration of 'index' shadows a global declaration"
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >Re: Stupid "warning: declaration of 'index' shadows a global declaration" (From: Steve Mills <email@hidden>)
 >Re: Stupid "warning: declaration of 'index' shadows a global declaration" (From: Clark Cox <email@hidden>)

  • Prev by Date: Re: Stupid "warning: declaration of 'index' shadows a global declaration"
  • Next by Date: Re: Stupid "warning: declaration of 'index' shadows a global declaration"
  • Previous by thread: Re: Stupid "warning: declaration of 'index' shadows a global declaration"
  • Next by thread: Re: Stupid "warning: declaration of 'index' shadows a global declaration"
  • Index(es):
    • Date
    • Thread