Re: Is "-init" really needed?
site_archiver@lists.apple.com Delivered-To: cocoa-dev@lists.apple.com Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc:x-sasl-enc; s=fm1; bh=mBhmXAqaCsvCcOI/0h 3L3C1lW62CZXOaZxmoeB7kiJA=; b=LkS0cgPPfyFQB7cGmAp+bpVSRDdzQQ6G2C ZZlMAPjDt3z6/OjiJxtDeYvgTgnT8+10P2sQwJh0gSOk/5qlFm4YpEbXXP+xYNQx XkjzOFUYevKoDvMXbAov4JynNugzYPOYKeCET++ZnoG6D519lMihvPX7gNMUrr7S nuMP2rkEP83PBQxdIH/RLv0e6Uc9jnD3V/p2PqsbD3IbI6oukrxpUg6lnlYoBBl0 7lwd8lnLVlOFLIov9hRV6r6A9onivFM2fXlqnX/AgSy5VrvpVL2OVOXhIvaDft92 Zjr7NDmSZ+202KKKQfD4AD6atv3WK1x+t49CAyJE5v+g2nfuvsQw==
On Aug 7, 2017, at 5:23 PM, Carl Hoefs <newslists@autonomy.caltech.edu> 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?) —Jens _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/site_archiver%40lists.appl... This email sent to site_archiver@lists.apple.com
participants (1)
-
Jens Alfke