Re: Memory Allocation
Re: Memory Allocation
- Subject: Re: Memory Allocation
- From: Quincey Morris <email@hidden>
- Date: Wed, 16 Jul 2008 15:02:33 -0700
On Jul 16, 2008, at 14:19, Michael Ash wrote:
Can you explain this, in particular how the "standard" initializer
sets you up for fewer seriously subtle errors than this one?
It seems to me that the possible return values from the [super init]
call can be broken into three categories:
A) self
B) nil
C) Something Else
This has been discussed on this list fairly recently. The pattern:
self = [super init...];
is both correct and required. See [NSManagedObject
initWithEntity:insertIntoManagedObjectContext:] for an example of when
the returned object is generally a different object.
There may be a couple of other cases where it matters, too (class
clusters are NOT currently one of those other cases), but you should
always assume initialization could return a different object or nil.
(And that was the official word from Apple.)
_______________________________________________
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