• 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: ryan <email@hidden>
  • Date: Tue, 28 Oct 2003 22:41:25 -0800

This is ObjectiveC exception handling.  If you visit:

/Developer/Documentation/Cocoa/Conceptual/ObjectiveC/index.html

View 'the objective c language' and then 'exceptions', here is the
example:


Cup *cup = [[Cup alloc] init];

@try {
     [cup fill];
}
@catch (NSException *exception) {
     NSLog(@"main: Caught %@: %@", [exception name], [exception reason]);
}
@finally {
     [cup release];
}

to throw an exception, do:
NSException * exception = ... ;
@throw exception ;

The documentation suggests that exceptions is available only on Mac OS
X 10.3.  I recall seeing exceptions on Jaguar/Project Builder.

Anyone want to expand on support of ObjC exceptions?  I thought it was
available at least on 10.2...

-ryan

I note that since ObjC objects can only realistically be created on the
heap, you don't have to work about 'unwind-protect' to call destructor
of stack objects.  There are some useful techniques with auto
destructing stack objects which might be nice, but hey :-)

PS: If you use @synchronized you incur the cost of a @try/@catch.  The
cost isn't entirely trivial either.



On Oct 28, 2003, at 8:21 PM, Martin-Gilles Lavoie wrote:

> For the life of me, I can't remember the syntax given for the new
> exception handling in Panther.
>
> It's something in the form
>
> 	@try
>
> 	@catch
>
> 	@foobar
>
> All documentation on Apple's site still point to the old (deprecated)
> NSDuring thing.
>
> Anybody remembers?
_______________________________________________
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: Frank Midgley <email@hidden>
References: 
 >Exception handling (From: Martin-Gilles Lavoie <email@hidden>)

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