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                 s...@rogue-research.com
Rogue Research                        www.rogue-research.com
Mac Software Developer              Montréal, Québec, Canada


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to