• 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: C++ exception results in SIGABRT
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: C++ exception results in SIGABRT


  • Subject: Re: C++ exception results in SIGABRT
  • From: Chris Espinosa <email@hidden>
  • Date: Tue, 19 Feb 2008 10:21:40 -0700


On Feb 19, 2008, at 9:45 AM, Stefan Werner wrote:

On Feb 18, 2008, at 8:11 PM, Howard Hinnant wrote:

Yes.  To propagate a C++ exception through a C stack frame, that C stack frame must be compiled with -fexceptions (which is defaulted off for .c files).  From the gcc docs:

However, you may need to enable this option when compiling C code that needs to interoperate properly with exception handlers written in C++.

Thanks, that was it.

I'm still puzzled about GCC_ENABLE_CPP_EXCEPTIONS though. The built-in documentation of it in Xcode is a verbatim copy of what the man page says about -fexceptions. However, GCC_ENABLE_CPP_EXCEPTIONS = YES odes not add -fexceptions. Is that desired behavior?

OK, this is a slightly deceptive artifact of Xcode's build system and build setting UI.

"Enable C++ Exceptions" only appears for targets that include C++ code.  Its default state is checked, that is, C++ exceptions are enabled by default; uncheckking it sets -fno-exceptions explicitly.

For C code it's absent, as C normally ignores this.

For mixed C and C++ code, the default item is present, but performs the default action in both languages, that is, leaves exceptions enabled in C++ but ignores them in C.  Which is not what you desire, no.  The solution is to explicitly check Enable C++ Exceptions at the target level, rather than leaving it enabled by default.  That way you get the consistent explicit behavior (-fexceptions) for both C and C++ code, rather than the inconsistent default behavior.

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

This email sent to email@hidden

  • Follow-Ups:
    • Re: C++ exception results in SIGABRT
      • From: Stefan Werner <email@hidden>
References: 
 >C++ exception results in SIGABRT (From: Stefan Werner <email@hidden>)
 >Re: C++ exception results in SIGABRT (From: Howard Hinnant <email@hidden>)
 >Re: C++ exception results in SIGABRT (From: Stefan Werner <email@hidden>)

  • Prev by Date: Re: C++ exception results in SIGABRT
  • Next by Date: Re: C++ exception results in SIGABRT
  • Previous by thread: Re: C++ exception results in SIGABRT
  • Next by thread: Re: C++ exception results in SIGABRT
  • Index(es):
    • Date
    • Thread