Monday, August 30, 2010

Warning : declaration of 'variableName' hides instance variable

The large number of warnings of the following kind seem to me really annoying, though I can realize the need of it.

declaration of 'variableName' hides instance variable

I googled for a nice work-around to avoid this warning but could not find any. Many have suggested to use underscore prefix for instance variables but some pointed out that underscore prefix notation has been reserved by Apple. The others suggested to use the convention of using the/a/an before the variable name but it seems to me quite distasteful!

Helpless, I opted for the latter solution :-(

References:
1. Objective-C convention to prevent “local declaration hides instance variable” warning
2. Suppressing variable hiding warning in Xcode
3. Parameters hide instance variables in Objective-C

No comments:

Post a Comment