Re: Proper idom for a failed init?
Re: Proper idom for a failed init?
- Subject: Re: Proper idom for a failed init?
- From: Dave Fayram <email@hidden>
- Date: Sat, 7 Sep 2002 18:14:04 -0700
The superclass probably won't fail its init, it's the subclass (this is
a subclass of object).
So I do a release of the object and return nil? Should I also throw and
exception?
On Saturday, September 7, 2002, at 06:13 PM, Lance Bland wrote:
On Saturday, September 7, 2002, at 08:54 PM, Dave Fayram wrote:
- initWithSomeCriticalJunk:(NSString *)junk
{
if( self = [super init] ) {
if( [junk isValid] ) {
// Keep initalizing
// ...
}
else {
// This should fail, what do I put here?
}
}
this is a trick question, because [super init] should have issued a
[self release] before returning nil. So, you should just return nil,
or return self, because self has value of nil.
-lance
------------------------------------
Lance Bland
mailto:email@hidden
web charts at http://www.vvi.com/products/chart
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.