• 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: Retain/Release and Properties clarification
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Retain/Release and Properties clarification


  • Subject: Re: Retain/Release and Properties clarification
  • From: Charles Srstka <email@hidden>
  • Date: Fri, 07 Oct 2011 14:34:05 -0500

On Oct 7, 2011, at 11:40 AM, Sean McBride wrote:

> On Mon, 3 Oct 2011 13:23:25 -0500, Charles Srstka said:
>
>> 1. Apple reserves the underscore prefix for their own use, so you could,
>> at least theoretically, clash with a superclass ivar this way, and
>
> In addition to what Kyle replied, I'd just like to point out that prefixing your *methods* with an underscore is a very bad idea, since Apple does reserve such names and a conflict will bite you at runtime possibly affecting the binary compatibility of your app.

Huh. I thought I’d remembered Apple having that same advice for ivars, and it turns out that they *used to* discourage starting ivars with an underscore:

http://web.archive.org/web/20040816203942/http://developer.apple.com/documentation/Cocoa/Conceptual/CodingGuidelines/Articles/NamingIvarsAndTypes.html

However, this isn’t on the current version of the page. So, I stand corrected regarding Apple’s advice. However, I still think it is a good idea to use a custom prefix for ivars to avoid weird effects from your ivar accidentally getting accessed by KVO or by object_setInstanceVariable.

Charles_______________________________________________

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: 
 >Retain/Release and Properties clarification (From: John Tsombakos <email@hidden>)
 >Re: Retain/Release and Properties clarification (From: John Tsombakos <email@hidden>)
 >Re: Retain/Release and Properties clarification (From: Charles Srstka <email@hidden>)
 >Re: Retain/Release and Properties clarification (From: Sean McBride <email@hidden>)

  • Prev by Date: RE: Problem with AVFoundation
  • Next by Date: Re: Quicklook not working for network volume items
  • Previous by thread: Re: Retain/Release and Properties clarification
  • Next by thread: Re: Retain/Release and Properties clarification
  • Index(es):
    • Date
    • Thread