Re: Dependent values that are not iVars
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