Thanks to both of you for clarifying this and for a nice solution. Basically then, I must not use address pointed to, but instead, the address of the pointer itself.
I liked the readability of using a string, but I think there is too much room for misinterpretation, conflating the contents of the string with the uniqueness requirement. Regards, Sandor Szatmari > On Sep 23, 2016, at 05:04, Quincey Morris > <quinceymor...@rivergatesoftware.com> wrote: > >> On Sep 23, 2016, at 01:36 , Alastair Houghton <alast...@alastairs-place.net> >> wrote: >> >> Note that you can use *any* type for your variable; in some ways, it might >> make sense to use a non-pointer type, just to make clear that it’s the >> address that matters, e.g. >> >> static const int kMyContext = 0xabadf00d; >> >> Otherwise some smart-ass might go and delete the “&” operators from your >> code, and that makes it vulnerable to problems. > > As previously mentioned, the safest way to do this is: > >> static void* kMyContext = &kMyContext; > > > That makes the “&” optional (at comparison time), and it should even avoid > the coalescing problem if it’s declared const. > > _______________________________________________ > > 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: > https://lists.apple.com/mailman/options/cocoa-dev/admin.szatmari.net%40gmail.com > > This email sent to admin.szatmari....@gmail.com _______________________________________________ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com