• 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: Exception handling
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Exception handling


  • Subject: Re: Exception handling
  • From: Scott Thompson <email@hidden>
  • Date: Thu, 30 Oct 2003 20:54:49 -0600

On Oct 30, 2003, at 1:51 PM, Michael B. Johnson wrote:

Can anyone comment on why this isn't on by default? In other words, what's the cost (execution speed or app size, or layout in address space) of enabling this? I'd like to put it on by default for my stuff, but I'm not sure if there are carrying costs like C++'s exceptions...


The objective-C language-based exception mechanism is exactly the same as the mechanism used for the DURING/HANLDER macros. It is a setjmp/longjmp based scheme. As such it would have the same overhead as the macro based exceptions. By in large this is a minimal runtime cost (to set up the setjmp/longjmp frames stack) and a small runtime memory overhead during execution to hold those frames.



The current gcc implementation of C++ exceptions has a higher application size impact to store the exception tables and stack unwinding code, but has virtually no impact on execution speed (until an exception is thrown).


It is important to note, however, (particularly for Objective-C++ programmers) it is probably unwise to mix the exception mechanisms. Particularly, with the Objective-C language based exceptions, your C++ stack-based objects will NOT be properly destroyed while the stack unwinds from an Objective-C language exception.

This can lead to bad problems if you are not aware of it.

Scott
_______________________________________________
xcode-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/xcode-users
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Exception handling
      • From: Martin-Gilles Lavoie <email@hidden>
References: 
 >Exception handling (From: Martin-Gilles Lavoie <email@hidden>)
 >Re: Exception handling (From: ryan <email@hidden>)
 >Re: Exception handling (From: Frank Midgley <email@hidden>)
 >Re: Exception handling (From: Chris Hanson <email@hidden>)
 >Re: Exception handling (From: "Michael B. Johnson" <email@hidden>)

  • Prev by Date: Re: Exception handling
  • Next by Date: Re: Code Balancing
  • Previous by thread: Re: Exception handling
  • Next by thread: Re: Exception handling
  • Index(es):
    • Date
    • Thread