• 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: Jim Correia <email@hidden>
  • Date: Sat, 14 Nov 2009 16:41:16 -0500

On Fri, Nov 13, 2009 at 6:20 PM, Jens Alfke <email@hidden> wrote:
This is why I never turn on that warning — due to namespace pollution by the standard C library and POSIX APIs, too many common variable names happen to shadow some function like 'index' or 'time' or 'open'.

I don't agree with Peter Hosey's position in that blog post. I posted this as a comment:

It does seem like a specious argument. He writes: "Since there is something named index, your code compiles. It's the wrong type, so you'll get a warning, but maybe you don't notice it."

So, assuming some compiler configuration where this is a warning and not an "array subscript is not an integer" problem (or some other specific error), to get yourself into this position you have to be the kind of person who would notice and fix the shadow warning, but not notice and fix some other kind of warning.

All warnings that are worth enabling are worth eliminating from your codebase. Why would you turn on a particular warning, then regularly ignore it?

- Jim
 _______________________________________________
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: 
 >Stupid "warning: declaration of 'index' shadows a global declaration" (From: Keary Suska <email@hidden>)
 >Re: Stupid "warning: declaration of 'index' shadows a global declaration" (From: BJ Homer <email@hidden>)
 >Re: Stupid "warning: declaration of 'index' shadows a global declaration" (From: Jens Alfke <email@hidden>)

  • Prev by Date: Re: Setting Xcode fonts and sizes
  • Next by Date: Xcode not responding when running unit tests
  • Previous by thread: Re: Stupid "warning: declaration of 'index' shadows a global declaration"
  • Next by thread: Setting Xcode fonts and sizes
  • Index(es):
    • Date
    • Thread