Subject: Re: Is "-init" really needed?
> On Aug 7, 2017, at 5:23 PM, Carl Hoefs <[email protected]> wrote:
> Is the use of +new discouraged also?
No, I use it all the time. It’s simply shorthand for [[XXX alloc] init].
These days with ARC, I tend to use +new instead of factory class methods — e.g.
[NSMutableArray new] instead of [NSMutableArray array] — on the assumption that
this avoids adding the new object to the autorelease pool. However, it’s
possible the compiler & runtime are smart enough to optimize the autorelease
out of the second call. (Greg?)
Cocoa-dev mailing list ([email protected]
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 protected]