On Jul 10, 2008, at 7:25 AM, an0 wrote:
I've been always stumbling on the embarrassment of "warning: local
declaration of 'xxx' hides instance variable" for my init methods,
because I really can't figure out a nice naming pattern for parameters
used to assign to instance properties, and I am always apt to write
code like this:
- (id)initWithURL:(NSString *)url title:(NSString *)title
tags:(NSString *)tags note:(NSString *)note time:(NSString *)time
count:(NSUInteger)count
since it is most natural(to me). Then I just see XCode spew out lots
of annoying warnings like these:
Line Location Post.m:28: warning: local declaration of 'url' hides
instance variable
Line Location Post.m:28: warning: local declaration of 'url' hides
instance variable
Line Location Post.m:29: warning: local declaration of 'title' hides
instance variable
Line Location Post.m:29: warning: local declaration of 'title' hides
instance variable
Line Location Post.m:32: warning: local declaration of 'time' hides
instance variable
Line Location Post.m:32: warning: local declaration of 'time' hides
instance variable
Line Location Post.m:30: warning: local declaration of 'tags' hides
instance variable
Line Location Post.m:30: warning: local declaration of 'tags' hides
instance variable
Even though I then follow the general naming rules to prepend an
indefinite article to each singular noun, I still have those plural
nouns sitting there, which now looks this:
- (id)initWithURL:(NSString *)aUrl title:(NSString *)aTitle
tags:(NSString *)tags note:(NSString *)aNote time:(NSString *)aTime
count:(NSUInteger)aCount
Set aside the oddness of aTime and aCount, my XCode still complain:
Line Location Post.m:30: warning: local declaration of 'tags' hides
instance variable
Line Location Post.m:30: warning: local declaration of 'tags' hides
instance variable
Am I supposed to use something like aGroupOfTags instead of just tags?
"someTags"?
I'd probably use "inTags"
-Steve
_______________________________________________
Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [EMAIL PROTECTED]