• 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: throw c++ exception abort app
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: throw c++ exception abort app


  • Subject: Re: throw c++ exception abort app
  • From: Gerard Iglesias <email@hidden>
  • Date: Fri, 11 Jul 2003 09:24:39 +0200

On Thursday, July 10, 2003, at 11:36 PM, Alastair J.Houghton wrote:

> According to Apple's documentation (not sure where I read this
> though), there are problems with exceptions if you mix Objective C and
> C++ code in the same application. You need to make sure that C++
> exceptions aren't thrown through Objective C parts of your program and
> vice-versa, otherwise bad things might happen.

The call stack I send happen in a pure C++ project compiled with the
3.3 version of gcc

It seems to me that when I investigate the problem further I succeed to
get exception handling correct in this kind of code :

#import <Foundation/Foundation.h>
#include <iostream>
void raise1(BOOL f)
{
if (f)
throw 1;
}
void raise2(BOOL f)
{
try{ raise1(YES);
}
catch(int v){ if (f)
throw 2;
}
}
int main (int argc, const char * argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
try
{ raise2(YES);
NSLog(@"Hello world");
}
catch(int e)
{ std::cerr << "exception: " << e << std::endl;
}
[pool release];
return 0;
}

but in a more complex program, the problem seems to come from the
allocation of object while throwing, and this allocation lead to an
abort

during the debug I get this while the exception is throwed:

#0 0x0003abcc in __cxa_allocate_exception at InputBuffer.hpp:132

Regards

GI
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: throw c++ exception abort app (From: "Alastair J.Houghton" <email@hidden>)

  • Prev by Date: Re: NSTextField, NSTextFieldCell, NSTextView... this is a mess, I need help
  • Next by Date: Application hides during processing
  • Previous by thread: Re: throw c++ exception abort app
  • Next by thread: installer
  • Index(es):
    • Date
    • Thread