Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Part VII: Completing Your Application > The Implementation of Exceptions

The Implementation of Exceptions

This section is somewhat advanced. Unless you are planning to mix Objective-C and C++, you can skip it. Exceptions are implemented with C’s setjmp library. setjmp does not invoke any of the destructors that C++ would invoke for stack-based C++ objects when unwinding the stack. This means that all of the destructors that would have been invoked by functions between the @catch block and the @throw statement are ignored. The implementation of exceptions is straightforward. NSExceptionFrames record the location of each @try block.

typedef struct
						NSExceptionFrame
{
  jmp_buf                  state;
  struct
						NSExceptionFrame *parent;
  NSException             *exception;
} NSExceptionFrame;

static
						NSExceptionFrame* _currentExceptionFrame = nil;


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free 10-Day Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint