• 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: Greg Parker <email@hidden>
  • Date: Fri, 29 Aug 2008 13:42:25 -0700

Gerriet Denkmann wrote:
While if fully agree with you about valid assumptions and so, I am still wondering what is the disadvantage of forgetting about NSEnumerator, Fast Enumeration and the like and simply doing:

unsigned count = [ array count ];
if ( count == 0 ) return;
for( unsigned i = count - 1;; i--)
{
        id a = [ array objectAtIndex: i ];
        if ( a is not nice ) [ array removeObjectAtIndex: i ];
        if ( i == 0 ) break;
}

That's a fine way of processing deletions from an array. You might prefer this C idiom to simplify the "loop backwards" code:


unsigned i = [ array count ];
while (i--) {
    id a = [ array objectAtIndex: i ];
    if ( a is not nice ) [ array removeObjectAtIndex: i ];
}


-- Greg Parker email@hidden Runtime Wrangler


_______________________________________________

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


  • Prev by Date: Re: understanding conversions between CF and NS datatypes
  • Next by Date: Re: understanding conversions between CF and NS datatypes
  • Previous by thread: Re: File Extensions Problem
  • Next by thread: Displaying time
  • Index(es):
    • Date
    • Thread