• 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: Why Don't Cocoa's (Un)Archiving Methods return Errors?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Why Don't Cocoa's (Un)Archiving Methods return Errors?


  • Subject: Re: Why Don't Cocoa's (Un)Archiving Methods return Errors?
  • From: Wade Tregaskis <email@hidden>
  • Date: Mon, 01 Aug 2011 17:51:31 -0700

>> Any code that throws exceptions will probably leak a few objects, since according to the ARC design doc the ABI requires not draining autorelease pools while unwinding the stack.
>
> Are you sure (or does ARC work differently)?
>
> <http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/MemoryMgmt/Articles/mmAutoreleasePools.html>:

That'll need to be updated.  If you look at the @autoreleasepool section of the ARC documentation, it specifically states that crossing out of one via an exception will not drain the pool.  There doesn't appear to be any way, even through compiler flags, to change this.

Also, if you look further, at the Exceptions section, it states that by default ARC is not exception-safe even aside from autorelease pools.  You can enable it, though - and it is enabled by default for Objective-C++ - using -fobjc-arc-exceptions.

You'll note that the "Rationale" comments on those two sections specifically lay out the expected usage of exceptions:  for programmer error.  That they're tolerated [somewhat] in Objective-C++ is simply a nod to history for the sake of compatibility.
_______________________________________________

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

  • Follow-Ups:
    • Re: Why Don't Cocoa's (Un)Archiving Methods return Errors?
      • From: Greg Parker <email@hidden>
  • Prev by Date: Re: Why Don't Cocoa's (Un)Archiving Methods return Errors?
  • Next by Date: Re: Why Don't Cocoa's (Un)Archiving Methods return Errors?
  • Previous by thread: Re: Why Don't Cocoa's (Un)Archiving Methods return Errors?
  • Next by thread: Re: Why Don't Cocoa's (Un)Archiving Methods return Errors?
  • Index(es):
    • Date
    • Thread