• 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: Fri, 13 Nov 2009 15:20:18 -0800


On Nov 13, 2009, at 1:38 PM, BJ Homer wrote:

See http://boredzo.org/blog/archives/2009-11-05/the-peril-of-the-index-function.  It only shows up if you turn on the shadowed-variables warning, but it's a valid warning.

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:
"I disagree. If you can pass a pointer as an array index and not get a compile error, something's dangerously wrong with your build process. This is why I ALWAYS, ALWAYS build with -Werror ("Treat warnings as errors".) There are too many things GCC treats as warnings that are very dangerous and should be fixed immediately. This goes double for Obj-C programming, where things like misspelled selectors only generate warnings."
—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

  • Follow-Ups:
    • Re: Stupid "warning: declaration of 'index' shadows a global declaration"
      • From: Jim Correia <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>)

  • Prev by Date: Re: Stupid "warning: declaration of 'index' shadows a global declaration"
  • Next by Date: Setting Xcode fonts and sizes
  • 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