• 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: Dependent values that are not iVars
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Dependent values that are not iVars


  • Subject: Re: Dependent values that are not iVars
  • From: "Sean McBride" <email@hidden>
  • Date: Fri, 18 Dec 2009 15:33:44 -0500
  • Organization: Rogue Research Inc.

On 12/18/09 12:13 PM, Quincey Morris said:

>Some people use globally unique strings for the context. I tend to use
>the class:
>
>	[addObserver: ... forKeyPath: ... options: ... context: [MyClass class]];

I suppose that usage is safe, but in general it's dangerous to use an
Obj-C object for the context, at least in GC apps.  That's because
context is a void* and therefore not __strong.  What I do (based on a
similar discussion on this list some time ago, is to declare globals like:

uint8_t kContext1 = <helpful # for debugging>;

then use &kContext1 as the context.

--
____________________________________________________________
Sean McBride, B. Eng                 email@hidden
Rogue Research                        www.rogue-research.com
Mac Software Developer              Montréal, Québec, Canada


_______________________________________________

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: 
 >Dependent values that are not iVars (From: Paul Bruneau <email@hidden>)
 >Re: Dependent values that are not iVars (From: Quincey Morris <email@hidden>)
 >Re: Dependent values that are not iVars (From: Paul Bruneau <email@hidden>)
 >Re: Dependent values that are not iVars (From: Quincey Morris <email@hidden>)

  • Prev by Date: Re: Dependent values that are not iVars
  • Next by Date: Menu items unexpectedly disabled
  • Previous by thread: Re: Dependent values that are not iVars
  • Next by thread: Re: Picking and Selection
  • Index(es):
    • Date
    • Thread