• 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: sortedArrayUsingFunction
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: sortedArrayUsingFunction


  • Subject: Re: sortedArrayUsingFunction
  • From: Keary Suska <email@hidden>
  • Date: Mon, 24 Aug 2009 17:26:39 -0600

On Aug 24, 2009, at 4:46 PM, Boyd Collier wrote:

The Discussion section in the current documentation for the NSArray method sortedArrayUsingFunction: context:
reads "The new array contains references to the receiver’s elements, not copies of them." Nothing is said about incrementing the retain count of the objects in the array, which seems reasonable. However, some time ago, I copied and pasted what was in Apple's earlier documentation into my code, and it read "The new array contains references to the receiver's elements, not copies of them. The retain count is incremented for each element in the receiving array." Was the second statement, i.e. that the retain count of each element is incremented, an error or has the method itself been changed, or am I misunderstanding something (always a strong possibility)?


The element objects will be retained by the new array (in addition to being retained by the original array). This isn't explicit because it is a function of NSArray by definition. Refer to the NSArray API doc for this explicitly.

For the sake of accuracy, you should replace every occurrence (including in your own brain) of the statement "The retain count is incremented" with "A -retain message is sent to". It is possible, and not uncommon, that the retain count of an object may never increase or decrease, as is the case for singletons. Such an increase or decrease should be irrelevant to you in most cases.

HTH,

Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"

_______________________________________________

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: 
 >sortedArrayUsingFunction (From: Boyd Collier <email@hidden>)

  • Prev by Date: Re: F-Script 2.0 available
  • Next by Date: Re: otest output in xUnit XML format?
  • Previous by thread: sortedArrayUsingFunction
  • Next by thread: [iphone] Rotating UIViews?
  • Index(es):
    • Date
    • Thread