RE: Suppressing variable hiding warning in Xcode
RE: Suppressing variable hiding warning in Xcode
- Subject: RE: Suppressing variable hiding warning in Xcode
- From: "Jeff Laing" <email@hidden>
- Date: Sun, 5 Apr 2009 18:20:33 -0600
- Thread-topic: Suppressing variable hiding warning in Xcode
> variables hiding instance variables a real nuisance. For example, if
> you have a message signature with a parameter name which matches an
> instance variable name, and the compiler produces the following
message:
>
> "warning: local declaration of '<variable name>' hides instance
variable"
What really annoyed me was that I had trivial variables called 'mxd' and
'myd' which corresponded to 'movement-x-delta' and 'movement-y-delta'.
It took forever to work out that 'myd' clashed with an enum value
defined somewhere for Date Ordering - MonthYearDay.
(It took so long because Xcode does such a crap job at displaying
multi-line error messages, and thus the 'original definition is here'
line was nowhere near the 'local names clash' line)
In this case, it wasn't instance variables, just locals vs an enum in an
enclosing scope.
Apple might think about using better (ie, prefixed) names for all their
enums if they are going to clash like this, otherwise the set of
available variable names is going to evaporate over time...
Jeff Laing <email@hidden>
------------------------------------------------------------------------
------
A complex system designed from scratch never works and cannot be patched
up to
make it work. You have to start over, beginning with a working simple
system.
-- J Gall. "Systemantics: How systems work and how they
fail"
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden