• 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: Stack unwinding with Objective C++
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Stack unwinding with Objective C++


  • Subject: Re: Stack unwinding with Objective C++
  • From: Chris Hanson <email@hidden>
  • Date: Sun, 6 Nov 2005 16:40:42 -0800

On Nov 6, 2005, at 2:49 PM, Tommy Nordgren wrote:
Is there any additional command line option I can pass to the compiler, when writing Cocoa Apps in
Objective C++, that will generate proper destuctor calls of C++ objects when unwinding the stack on
thrown exceptions. (I've tried with both C++ and Objective C exception handling systems - in neither
case I get calls of the destructor)

Objective-C++ lets you mix Objective-C and C++ at the statement level. It doesn't integrate the runtimes of the two languages to any but the most limited extent.


In Mac OS X 10.4 with GCC 4, that's been extended to include calling C ++ constructors and destructors for non-pointer objects declared as part of an Objective-C object. (The -fobjc-call-cxx-cdtors compiler flag.)

The exception-handling systems are still distinct. The Objective-C setjmp-based system won't invoke C++ destructors or otherwise unwind C ++ state. That said, between a C++ exception and its corresponding catch, C++ destructors should be invoked.

  -- Chris

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Stack unwinding with Objective C++
      • From: Uli Kusterer <email@hidden>
References: 
 >Stack unwinding with Objective C++ (From: Tommy Nordgren <email@hidden>)

  • Prev by Date: NSTextView scrolling issue.
  • Next by Date: Re: Preferences in a separate nib file
  • Previous by thread: Re: Stack unwinding with Objective C++
  • Next by thread: Re: Stack unwinding with Objective C++
  • Index(es):
    • Date
    • Thread