• 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: @try / @catch requires c++ exceptions?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >@try / @catch requires c++ exceptions? (From: Geoffrey Garen <email@hidden>)

  • Prev by Date: Re: [OT] What are the header files needed to write a debugger?
  • Next by Date: XCode's "Relative to Build Product" path type
  • Previous by thread: @try / @catch requires c++ exceptions?
  • Next by thread: [OT] What are the header files needed to write a debugger?
  • Index(es):
    • Date
    • Thread