Re: Re: Re: try/catch/throw/finally example?
Re: Re: Re: try/catch/throw/finally example?
- Subject: Re: Re: Re: try/catch/throw/finally example?
- From: "Shawn Erickson" <email@hidden>
- Date: Fri, 25 Aug 2006 16:24:10 -0700
On 8/25/06, Keith Ray <email@hidden> wrote:
I noticed that even though the compiler doesn't complain about about a
missing catch block, if it *is* missing, the finally block is never
executed.
@try {
[stringOne appendString:stringTwo];
} @finally {
NSLog(@"This always happens.");
}
I have never seen that and it would be a major compiler bug if it did.
You have an example of that shows this?
---
#import <Foundation/Foundation.h>
int main (int argc, const char * argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
NSString *stringOne = @"One";
NSString *stringTwo = @"Two";
@try {
[stringOne appendString:stringTwo];
} @finally {
NSLog(@"This always happens.");
}
[pool release];
return 0;
}
[Session started at 2006-08-25 16:22:15 -0700.]
2006-08-25 16:22:15.427 Test[19569] This always happens.
2006-08-25 16:22:15.428 Test[19569] *** Uncaught exception:
<NSInvalidArgumentException> Attempt to mutate immutable object with
appendString:
-Shawn
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden