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: 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