On Aug 29, 2008, at 11:27 AM, Michael Ash wrote:
This (void *)1091 business seems highly dangerous to me. After all,
what prevents somebody else from using 1091 too? If everybody uses a
pointer value that's guaranteed to be unique (like a unique string
literal) then you know you're safe.

It really just needs to be unique in your class hierarchy, right? But, yeah, it still seems dangerous. I mean, what number do you start using, and what if your class hierarchy changes?

I'm liking Ron's way, because that's guaranteed to be a unique pointer value. I still like the static string, too, but it sounds like in order to ensure uniqueness of the string within a class hierarchy, it may be a good idea to put the class name in there. Two classes using static @"Property Context" should still be unique, unless the linker does some cross-module string literal optimization so that there's only a single @"Property Context" string literal in the entire binary. I don't think it does now, but perhaps with LLVM it'll do more aggressive optimizations like this.

-Dave

_______________________________________________

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 [EMAIL PROTECTED]

Reply via email to