Re: self = [super init], nil?
Re: self = [super init], nil?
- Subject: Re: self = [super init], nil?
- From: Bill Bumgarner <email@hidden>
- Date: Fri, 07 May 2010 21:06:12 -0700
On May 7, 2010, at 11:34 AM, Patrick M. Rutkowski wrote:
> Will NSObject's init method ever really return nil?
>
> E.g. if I sub-class NSObject, then is it worth checking for nil after
> doing self = [super init]?
>
> I know there are many classes in UIKit and Cocoa which most definitely
> can return nil from their -init's, as an indication of failure. But
> will this ever be the case with NSObject?
As it is currently implemented? No.
As someone might implement it who swizzles -init or someday in some magical mystical software update? Probably not, but maybe.
The real question, though, is why do you want to have two patterns?
Just check for nil always and be done with it. One less irrelevant detail to worry about FTW!
b.bum
_______________________________________________
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