Re: File Extensions Problem
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