Re: @try / @catch requires c++ exceptions?
Re: @try / @catch requires c++ exceptions?
- Subject: Re: @try / @catch requires c++ exceptions?
- From: Prachi Gauriar <email@hidden>
- Date: Tue, 8 Nov 2005 10:07:28 -0500
On Nov 8, 2005, at 12:45 AM, Geoffrey Garen wrote:
Hi folks.
I recently discovered that if you want to build with objective-c
exceptions enabled you also have to enable c++ exceptions. This
seems like a bug, so I filed it (<rdar://problem/4333439> Compiling
with -fobjc-exceptions generates errors and crashes compiler unless
you also enable c++ exceptions).
Happens w/GCC 3.3 and 4.0. Doubly weird because you're not allowed
to mix objc and c++ exceptions.
Does anyone know why this might be the case, and if there's a work-
around?
I just tried this out, and my simple test case compiles and runs
fine. I disabled C++ Exceptions, enabled Objective-C exception
syntax, and built this code using Xcode 2.1 and GCC 4:
#import <Foundation/Foundation.h>
int main (int argc, const char *argv[])
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSArray *array = [NSArray arrayWithObjects:@"1", @"2", @"3", nil];
int i = 0;
for (i = 0; i <= [array count]; i++) {
@try {
NSLog(@"%@", [array objectAtIndex:i]);
} @catch (NSException *e) {
NSLog(@"Caught exception with name %@.", [e name]);
}
}
[pool release];
return 0;
}
What version of Xcode are you using?
-Prachi
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden