On Sep 21, 2016, at 16:44 , Gabriel Zachmann <[email protected]> wrote: > > how can the compiler know that '==' in this case is a NSString comparison?
It can’t because it isn't. What’s being compared are raw pointers. The string value is irrelevant. > Or is some other magic going on here? if so, which? No magic, but a (not very good) assumption, that literal strings are unique at run time, so a pointer to a particular literal string is a globally unique identifier. Incidentally, this assumption is true only within a target. Literal strings in different targets may have different pointers. So, this technique is generally Not A Good Idea™. _______________________________________________ Cocoa-dev mailing list ([email protected]) 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 [email protected]
