• 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: How do I disable this warning: "local declaration of 'varname' hides instance variable"
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How do I disable this warning: "local declaration of 'varname' hides instance variable"


  • Subject: Re: How do I disable this warning: "local declaration of 'varname' hides instance variable"
  • From: j o a r <email@hidden>
  • Date: Sun, 23 Mar 2008 21:12:57 -0700

Chuck,

* You really shouldn't suppress these warnings

* If you use ObjC 2.0 properties you don't have to write those accessors in the first place, and

* If you use ObjC 2.0 properties, you can use this form without warnings:

	self.foo = foo;

j o a r


On Mar 23, 2008, at 8:59 PM, charlie wrote:

For years, I've been doing this:

- (void)setController:(id)_controller
{
if (!_controller)
{
  return;
}
controller = [_controller retain];
}



It has always irked me having to work around namespace conflicts between method args and instance variables.

So, today I decided to try this for my next project...

- (void)setController:(id)controller
{
if (!controller)
{
  return;
}
self->controller = [controller retain];
}



I works fine.  But does not fix the warning itself.




So, the question stands.... How do I suppress the warning.


- Chuck

_______________________________________________

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


References: 
 >Re: How do I disable this warning: "local declaration of 'varname' hides instance variable" (From: "charlie" <email@hidden>)

  • Prev by Date: Re: How do I disable this warning: "local declaration of 'varname' hides instance variable"
  • Next by Date: Re: Beginner with Cocoa
  • Previous by thread: Re: How do I disable this warning: "local declaration of 'varname' hides instance variable"
  • Next by thread: Re: How do I disable this warning: "local declaration of 'varname' hides instance variable"
  • Index(es):
    • Date
    • Thread