Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>From <a href="https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/Exceptions/Tasks/HandlingExceptions.html" rel="nofollow">https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/Exceptions/Tasks/HandlingExceptions.html</a>:</p> <p><code>@finally — Defines a block of related code that is subsequently executed whether an exception is thrown or not.</code></p> <p>But it says nothing about exceptions in catch blocks. It sounds logical that this exception wouldn't be cought.</p> <p>I've made simple program to check that:</p> <pre><code>import &lt;Foundation/Foundation.h&gt; int main(int argc, char **argv) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init] ; int result = 0 ; @try { @throw [NSException exceptionWithName:@"Exception" reason:@"@try" userInfo:nil]; } @catch (id exception) { @throw [NSException exceptionWithName:@"Exception" reason:@"@catch" userInfo:nil]; } @finally { NSLog(@"Finally"); } [pool release] ; return result ; } </code></pre> <p>Simply compile and execute that:</p> <pre><code>$ gcc -framework Foundation -fobjc-exceptions test.m $ ./a.out 2012-12-29 00:39:21.667 a.out[86205:707] *** Terminating app due to uncaught exception 'Exception', reason: '@catch' *** First throw call stack: ( 0 CoreFoundation 0x00007fff8e3050a6 __exceptionPreprocess + 198 1 libobjc.A.dylib 0x00007fff8e56e3f0 objc_exception_throw + 43 2 a.out 0x0000000107d48d47 main + 359 3 libdyld.dylib 0x00007fff90b4e7e1 start + 0 ) libc++abi.dylib: terminate called throwing an exception Abort trap: 6 </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload