• 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: [[Class alloc] init] preferable over [[Class instance] retain]?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >[[Class alloc] init] preferable over [[Class instance] retain]? (From: Laurent Daudelin <email@hidden>)
 >Re: [[Class alloc] init] preferable over [[Class instance] retain]? (From: Luke the Hiesterman <email@hidden>)
 >Re: [[Class alloc] init] preferable over [[Class instance] retain]? (From: Alexander Spohr <email@hidden>)

  • Prev by Date: Re: [[Class alloc] init] preferable over [[Class instance] retain]?
  • Next by Date: Bison/Yacc with Objective-C ?
  • Previous by thread: Re: [[Class alloc] init] preferable over [[Class instance] retain]?
  • Next by thread: Re: [[Class alloc] init] preferable over [[Class instance] retain]?
  • Index(es):
    • Date
    • Thread