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

Re: File Extensions Problem


  • Subject: Re: File Extensions Problem
  • From: Uli Kusterer <email@hidden>
  • Date: Fri, 29 Aug 2008 10:55:58 +0200

On 29.08.2008, at 02:12, Graham Cox wrote:
Well, that was me. But I do see the error of my ways... I guess it was Michael Ash's comment that NSArray *could* change its storage half way through enumeration (if the collection were mutated) that woke me up. I suspect it would only do this if the collection dramatically changed in size but clearly that wouldn't be something to rely on. I checked my own code to make sure I wasn't following my own "advice" anywhere and turns out I've never done it without making a copy anyway.


One other reason why this is dangerous is that NSArray isn't guaranteed to be a plain C-style array, internally.

NSArray is a very abstractly defined collection class. It gives you some performance guarantees for its operations, but beyond that it may choose any implementation it wishes. So, it could actually implement itself as a tree, or a linked list, or a simple C array of pointers, ... or hamsters in a box, for all we care. It could even store the array backwards internally, which would mean that every removal from the end changes all the pointers, while removal from the start would be safe.

Cheers,
-- Uli Kusterer
"The Witnesses of TeachText are everywhere..."
http://www.zathras.de





_______________________________________________

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: 
 >File Extensions Problem (From: Adil Saleem <email@hidden>)
 >Re: File Extensions Problem (From: Michael Dautermann <email@hidden>)
 >Re: File Extensions Problem (From: Andrew Merenbach <email@hidden>)
 >Re: File Extensions Problem (From: Graham Cox <email@hidden>)
 >Re: File Extensions Problem (From: Phil <email@hidden>)
 >Re: File Extensions Problem (From: Graham Cox <email@hidden>)
 >Re: File Extensions Problem (From: "Michael Ash" <email@hidden>)
 >Re: File Extensions Problem (From: Thomas Engelmeier <email@hidden>)
 >Re: File Extensions Problem (From: "R.L. Grigg" <email@hidden>)
 >Re: File Extensions Problem (From: Ken Thomases <email@hidden>)
 >Re: File Extensions Problem (From: "R.L. Grigg" <email@hidden>)
 >Re: File Extensions Problem (From: Ken Thomases <email@hidden>)
 >Re: File Extensions Problem (From: Graham Cox <email@hidden>)

  • Prev by Date: Re: CFBundleIconFile: heiß or hot?
  • Next by Date: Busy doing nothing
  • Previous by thread: Re: File Extensions Problem
  • Next by thread: Re: File Extensions Problem
  • Index(es):
    • Date
    • Thread