• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Is @"constantstring" pointer equal to @"constantstring" a guarantee?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Is @"constantstring" pointer equal to @"constantstring" a guarantee? (From: Nathan Vander Wilt <email@hidden>)

  • Prev by Date: Re: NSScroller question
  • Next by Date: Re: NSScroller question
  • Previous by thread: Is @"constantstring" pointer equal to @"constantstring" a guarantee?
  • Next by thread: Re: Is @"constantstring" pointer equal to @"constantstring" a guarantee?
  • Index(es):
    • Date
    • Thread