• 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: "Glenn L. Austin" <email@hidden>
  • Date: Fri, 07 Oct 2011 10:21:41 -0700

On Oct 7, 2011, at 9: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.
>
> IMHO, prefixing your ivars with underscore is a good idea because it's typical convention.  A conflict has never happened to me, and would mostly be a compile-time problem.  But your point about KVO is a good one!  Has anyone been bit by it?

Do I really need to quote the C and C++ standards that states that a leading underscore on a symbol is reserved to the implementation -- in other words 'the implementation' is everything that you're not writing?

The proper way (today) to mark an ivar as private is to use @private.  Go ahead and use a leading underscore, but don't be surprised if sometime in the future you are debugging a strange compile-time error. (I've been 'bit' by this a few times in my development).

--
Glenn L. Austin, Computer Wizard and Race Car Driver         <><
"Where there's breath, there's hope!"
<http://www.austin-soft.com>

_______________________________________________

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

  • Follow-Ups:
    • Re: Retain/Release and Properties clarification
      • From: Andy Lee <email@hidden>
    • Re: Retain/Release and Properties clarification
      • From: Sean McBride <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: Retain/Release and Properties clarification
  • Next by Date: Re: Retain/Release and Properties clarification
  • Previous by thread: Re: Retain/Release and Properties clarification
  • Next by thread: Re: Retain/Release and Properties clarification
  • Index(es):
    • Date
    • Thread