• 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: Quincey Morris <email@hidden>
  • Date: Tue, 29 Jan 2013 23:40:18 -0800

On Jan 29, 2013, at 23:25 , 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.)

Oops, I'm always getting that backwards. Need to go fix some code, now that I think about it.

> Return `(instancetype)` instead of `(id)` or `(Bla *)`. Otherwise you won't work well with subclasses. (The compiler will assume instancetype if your method is named `new...`, but not if you use some other name.)

That one's new to me. Completely undocumented on developer.apple.com, I notice. Which Xcode has the clang that has it?

But doesn't 'id' still mean the same thing when the method family is 'new…', as it formerly did?

_______________________________________________

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


  • Follow-Ups:
    • Re: verify input parameter of init method and return nil before invoke [super init]
      • From: Charles Srstka <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>)

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