Re: [[Class alloc] init] preferable over [[Class instance] retain]?
Re: [[Class alloc] init] preferable over [[Class instance] retain]?
- Subject: Re: [[Class alloc] init] preferable over [[Class instance] retain]?
- From: Nick Zitzmann <email@hidden>
- Date: Tue, 9 Mar 2010 14:58:48 -0700
On Mar 9, 2010, at 2:50 PM, Alexander Spohr wrote:
> I’d use
> NSMutableArray *anArray = [NSMutableArray new];
> in this case ;)
FWIW, I prefer to use alloc-init for one main reason: When I want to look for places in the code that initialize certain objects (which does happen in large code bases), it helps to keep the method of initialization consistent. That way, I only need to search for "MyObject alloc" and nothing else... Of course, if you use new consistently, then that's fine as well, as long as consistency is kept.
Nick Zitzmann
<http://www.chronosnet.com/>
_______________________________________________
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