[[Class alloc] init] preferable over [[Class instance] retain]?
[[Class alloc] init] preferable over [[Class instance] retain]?
- Subject: [[Class alloc] init] preferable over [[Class instance] retain]?
- From: Laurent Daudelin <email@hidden>
- Date: Tue, 9 Mar 2010 13:41:03 -0800
I've been running in that situation and I'm just wondering if there are any advice for/against one or the other method.
For example, is:
NSMutableArray *anArray = [[NSMutableArray array] retain];
better than:
NSMutableArray *anArray = [[NSMutableArray alloc] init];
?
I know that for instances where I know in advance how many items, I imagine and expect that initWithCapacity: is better, but for those cases where you don't know?
-Laurent.
--
Laurent Daudelin
AIM/iChat/Skype:LaurentDaudelin http://nemesys.dyndns.org
Logiciels Nemesys Software email@hidden
Photo Gallery Store: http://laurentdaudelin.shutterbugstorefront.com/g/galleries
_______________________________________________
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