• 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: array = [NSArray new] or array = [NSArray array]?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: array = [NSArray new] or array = [NSArray array]?


  • Subject: Re: array = [NSArray new] or array = [NSArray array]?
  • From: Doug Hill <email@hidden>
  • Date: Fri, 19 Aug 2016 10:39:45 -0700

FWIW, I use the [Classname new] syntax when allocating just about any object instead of [[Classname alloc] init]. Including with arrays, especially NSMutableArray. I've never seen any issues.

Doug Hill


> On Aug 16, 2016, at 2:20 AM, Alex Zavatone <email@hidden> wrote:
>
> Yes, I know about literals, but I have a different question here.
>
> I have seen this in some code in our codebase:
> array = [NSArray new];
>
> I'm familiar with using the public method from the NSArray header and what the docs say to use:
> or array = [NSArray array];
>
> Is there any risk to using [NSArray new] to init an array instead of [NSArray array]??
>
> I'm surprised to see this being used in our codebase and would like to make sure we are not destroying the universe by using it.
>
> Thank you in advance.
> - Alex Zavatone


_______________________________________________

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: 
 >array = [NSArray new] or array = [NSArray array]? (From: Alex Zavatone <email@hidden>)

  • Prev by Date: Re: Launch, connect, communicate
  • Next by Date: Re: Resend: array = [NSArray new] or array = [NSArray array]?
  • Previous by thread: array = [NSArray new] or array = [NSArray array]?
  • Next by thread: Re: array = [NSArray new] or array = [NSArray array]?
  • Index(es):
    • Date
    • Thread