• 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: Proper idom for a failed init?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Prev by Date: Re: NEWBIE: NSArray toll-free-bridged with CFArray?
  • Next by Date: Re: Proper idom for a failed init?
  • Previous by thread: Re: OT: fun with phonics...
  • Next by thread: Re: Proper idom for a failed init?
  • Index(es):
    • Date
    • Thread