• 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: Calling a Cocoa library from C
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Calling a Cocoa library from C


  • Subject: Re: Calling a Cocoa library from C
  • From: Ken Thomases <email@hidden>
  • Date: Mon, 14 Nov 2011 16:52:16 -0600

On Nov 14, 2011, at 3:26 PM, Charles Srstka wrote:

> On Nov 14, 2011, at 1:40 PM, Ken Thomases wrote:
>
>> But NSAutoreleasePool doesn't drain on an exception, since it doesn't have an explicit scope.  Code posted earlier in this thread used @try-@finally to explicitly drain the pool.  So, while @autoreleasepool would be equivalent to a naive use of NSAutoreleasePool, it's not equivalent to the earlier code.
>>
>> Quoting from the Transitioning to ARC Release Notes <http://developer.apple.com/library/mac/#releasenotes/ObjectiveC/RN-TransitioningToARC/_index.html>:
>>
>>> On entry, an autorelease pool is pushed. On normal exit (break, return, goto, fall-through, and so on) the autorelease pool is popped. For compatibility with existing code, if exit is due to an exception, the autorelease pool is not popped.
>
> You can always put your @try/@catch block inside the @autoreleasepool block, and ensure that it drains normally that way.

Yes, of course, which I think was Jean-Daniel's point in raising the warning: to make sure one considered that.

Regards,
Ken

_______________________________________________

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: 
 >Calling a Cocoa library from C (From: Nathan Sims <email@hidden>)
 >Re: Calling a Cocoa library from C (From: Wim Lewis <email@hidden>)
 >Re: Calling a Cocoa library from C (From: Charles Srstka <email@hidden>)
 >Re: Calling a Cocoa library from C (From: Jean-Daniel Dupas <email@hidden>)
 >Re: Calling a Cocoa library from C (From: Greg Parker <email@hidden>)
 >Re: Calling a Cocoa library from C (From: Ken Thomases <email@hidden>)
 >Re: Calling a Cocoa library from C (From: Charles Srstka <email@hidden>)

  • Prev by Date: Re: Witch controls to use to implement an Xcode (4.2) like "toolbar view"
  • Next by Date: Re: Cannot D&D from an NSTableView
  • Previous by thread: Re: Calling a Cocoa library from C
  • Next by thread: Re: Calling a Cocoa library from C
  • Index(es):
    • Date
    • Thread