• 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: verify input parameter of init method and return nil before invoke [super init]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: verify input parameter of init method and return nil before invoke [super init]


  • Subject: Re: verify input parameter of init method and return nil before invoke [super init]
  • From: Greg Parker <email@hidden>
  • Date: Wed, 30 Jan 2013 01:07:35 -0800

On Jan 30, 2013, at 12:42 AM, Charles Srstka <email@hidden> wrote:
> On Jan 30, 2013, at 1:25 AM, Greg Parker <email@hidden> wrote:
>> Name the method `new...` instead of `create...`. Otherwise you do suffer an autorelease penalty with ARC. (`create...` is not one of the names that ARC assumes will return a retained result.)
>
> Huh? I thought ARC generated objc_autoreleaseReturnValue in this case, which peeks up the stack to see if the caller is calling objc_retainAutoreleasedReturnValue on it, and refrains from autoreleasing the object if it does.

It does. All of that is relatively inexpensive, but still has a cost. Simply passing along the retained value as returned by -init... is free. (Ideally, +new... tail-calls -init...)


--
Greg Parker     email@hidden     Runtime Wrangler



_______________________________________________

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: 
 >verify input parameter of init method and return nil before invoke [super init] (From: Bob Cromwell <email@hidden>)
 >Re: verify input parameter of init method and return nil before invoke [super init] (From: Quincey Morris <email@hidden>)
 >Re: verify input parameter of init method and return nil before invoke [super init] (From: Ken Thomases <email@hidden>)
 >Re: verify input parameter of init method and return nil before invoke [super init] (From: Quincey Morris <email@hidden>)
 >Re: verify input parameter of init method and return nil before invoke [super init] (From: Greg Parker <email@hidden>)
 >Re: verify input parameter of init method and return nil before invoke [super init] (From: Quincey Morris <email@hidden>)
 >Re: verify input parameter of init method and return nil before invoke [super init] (From: Charles Srstka <email@hidden>)

  • Prev by Date: Can anything prevent dispatch_async() from executing its block?
  • Next by Date: Re: NSDocument's Open File Panel unresponsive when opening large file from disc
  • Previous by thread: Re: verify input parameter of init method and return nil before invoke [super init]
  • Next by thread: Re: verify input parameter of init method and return nil before invoke [super init]
  • Index(es):
    • Date
    • Thread