Re: Is @"constantstring" pointer equal to @"constantstring" a guarantee?
Re: Is @"constantstring" pointer equal to @"constantstring" a guarantee?
- Subject: Re: Is @"constantstring" pointer equal to @"constantstring" a guarantee?
- From: Bill Bumgarner <email@hidden>
- Date: Thu, 27 Mar 2008 16:28:52 -0700
On Mar 27, 2008, at 4:20 PM, Nathan Vander Wilt wrote:
So does that mean once I'm up at the Cocoa level, that
constant strings *are* guaranteed to have the same
pointer if their contents are the same? What is
"unique" and what is a "module" in this context?
They might be unique, they might not. It might change over time or in
context of usage. And it may change if you suddenly decide that one
of those global constant strings really needs to be configurable at
runtime.
Best not to rely upon it.
In general, -isEqual*: methods are optimized to check for pointer
identity equality, if it is a significant optimization. Certainly, the
cost of a msgSend() is greater than a pointer equality test, but
likely not in any significant fashion.
Instruments or Shark can, of course, answer whether or not it matters.
b.bum
_______________________________________________
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