• 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: warning: local declaration hides instance variable
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: warning: local declaration hides instance variable


  • Subject: Re: warning: local declaration hides instance variable
  • From: David Dunham <email@hidden>
  • Date: Mon, 3 Sep 2007 17:56:09 -0700

On 3 Sep 2007, at 16:54, Jeff Laing wrote:

Depends on how much you like coding methods called:

-ism_myvar -setm_myvar:

etc. KVC seems to default to property 'x' being implemented as instance
variable 'x' or '_x'


Now, sure, you can row upstream and deliberately make your keypaths
different to your instance variable names. That way lies great
productivity...

Well, a lot of the time you need something like

- (void) setBullets: (NSString*) aString
{
	[aString retain];
	[fBullets release];
	fBullets = aString;
}

anyway, so it's not like you're writing much extra code. And the scope prefix ('f', from Apple's C++ style guide) always tells you you're dealing with instance data.

And if you don't have Apple's guideline wired in, you can use the prefix '_' and still make it clear what's instance data. You don't have to write

- (NSString*) bullets { return _bullets; }

for KVM, but you still need to write the setter...

David Dunham     A Sharp, LLC
Voice/Fax: 206 783 7404     http://a-sharp.com
Efficiency is intelligent laziness.

_______________________________________________
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


References: 
 >RE: warning: local declaration hides instance variable (From: Jeff Laing <email@hidden>)

  • Prev by Date: Re: Getting rid of Obj-C "may not respond to" warning
  • Next by Date: RE: warning: local declaration hides instance variable
  • Previous by thread: RE: warning: local declaration hides instance variable
  • Next by thread: RE: warning: local declaration hides instance variable
  • Index(es):
    • Date
    • Thread