• 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: try / finally
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: try / finally


  • Subject: Re: try / finally
  • From: Greg Titus <email@hidden>
  • Date: Tue, 20 May 2003 18:54:58 -0700

Because he wants to reraise the exception. If you don't want to repeat the cleanup twice in Obj-C you need to do something like:

NSException *exception = nil;

NS_DURING
...
NS_HANDLER
...
exception = localException;

NS_ENDHANDLER

// clean up
[exception raise]; // will do nothing if exception is still nil.

Hope this helps,
- Greg


On Tuesday, May 20, 2003, at 06:40 PM, Scott Anguish wrote:

why not

NS_DURING
...

NS_HANDLER
...

NS_ENDHANDLER

// cleanup


On Tuesday, May 20, 2003, at 06:56 PM, Simon Bovet wrote:

Is there any way in ObjC/ObjC++ to write a termination block, such as the try { ... } finally { ... }, or do I have to rewrite twice the cleaning up lines in

NS_DURING

...
// clean up

NS_HANDLER
...
// clean up
[localException raise];

NS_ENDHANDLER

I guess so. I'm just wondering...

_______________________________________________
MacOSX-dev mailing list
email@hidden
http://www.omnigroup.com/mailman/listinfo/macosx-dev

_______________________________________________
MacOSX-dev mailing list
email@hidden
http://www.omnigroup.com/mailman/listinfo/macosx-dev
_______________________________________________
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.

References: 
 >Re: try / finally (From: Scott Anguish <email@hidden>)

  • Prev by Date: Re: Speed Traps
  • Next by Date: AS in Cocoa prob (LONG)
  • Previous by thread: Re: try / finally
  • Next by thread: AS in Cocoa prob (LONG)
  • Index(es):
    • Date
    • Thread