• 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: exception in init
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: exception in init


  • Subject: Re: exception in init
  • From: Jens Alfke <email@hidden>
  • Date: Thu, 05 Apr 2012 08:58:53 -0700

On Apr 5, 2012, at 5:59 AM, Ariel Feinerman wrote:

> the next provocative question is whether can we release self in init before
> raise an exception? I think it has own reason.

Yes, you can release self* in an init method before returning nil or raising an exception.

Although if raising an exception, things are going to be in a weird state afterwards anyway, so leaking your object probably isn't significant. For example, if you call NSParameterAssert in your init method and it fails, the exception will be raised without giving you a chance to release. But if you want to call [self release] before @throw, that's fine.

—Jens

* unless you're using ARC or GC, of course.

_______________________________________________

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


References: 
 >exception in init (From: Ariel Feinerman <email@hidden>)
 >Re: exception in init (From: Andreas Grosam <email@hidden>)
 >Re: exception in init (From: Jens Alfke <email@hidden>)
 >Re: exception in init (From: Andreas Grosam <email@hidden>)
 >Re: exception in init (From: Corbin Dunn <email@hidden>)
 >Re: exception in init (From: Andreas Grosam <email@hidden>)
 >Re: exception in init (From: Ariel Feinerman <email@hidden>)

  • Prev by Date: Re: exception in init
  • Next by Date: "Allow location" dialog dismisses immediately after presenting
  • Previous by thread: Re: exception in init
  • Next by thread: Re: exception in init
  • Index(es):
    • Date
    • Thread