[ODE] Using exceptions to catch errors

Shamyl Zakariya shamyl at zakariya.net
Fri Aug 13 16:40:49 MST 2004


I really appreciate the suggestions. Unfortunately, I haven't had the 
time to do some real investigation, though it should be clarified that 
I removed the fno-exceptions line from the build scripts.

I think tonight I will write a quick test which throws an exception and 
immediately calls abort() and i'll see what happens. If the exception 
prevents the abort, as it should, I'll see what happens when I package 
it into a static library and link against it.

Considering that by design what I've done simply SHOULD work, this 
sounds more like a linking issue or something else completely out of my 
league to debug properly, since I'm just a fellow having fun, not a 
professional.


On Aug 12, 2004, at 12:11 PM, Jon Watte wrote:

>
> I believe the C++ standard specifies that throws propagate through
> C linkage (without exception data) without specific object unwinding
> for objects active on the stack in those functions.
>
> A very simple test should also show you what's happening in this
> case.
>
> Cheers,
>
> 			/ h+
>
>
> -----Original Message-----
> From: ode-bounces at q12.org [mailto:ode-bounces at q12.org]On Behalf Of Adam
> Paul Coates
> Sent: Thursday, August 12, 2004 2:22 AM
> To: Shamyl Zakariya
> Cc: ode at q12.org
> Subject: RE: [ODE] Using exceptions to catch errors
>
>
> I've not been watching this thread until now, so maybe this has been
> asked.  Does it make a difference that dError is linked as a C-style
> function?  I'm not sure how the gcc linker handles this situation, but 
> is
> it possible that, to avoid throwing an exception to external C code, it
> either allows execution to continue, or instead calls the global
> unexpected() or terminate() functions (whose default behavior is to 
> call
> abort() I believe)?
>
> A quick experiment might be in order to test this if it sounds 
> reasonable.
> You can install your own unexpected() and terminate() handlers via
> set_unexpected() and set_terminate().
>
> Hope that helps;  I'd be curious to know whether this is the reason.
>
> Adam C.
>
>
>> extern "C" void dError (int num, const char *msg, ...)
>> {
>>    va_list ap;
>>    va_start (ap,msg);
>>    if (error_function) error_function (num,msg,ap);
>>    else printMessage (num,"ODE Error",msg,ap);
>>    exit (1);
>> }
>
>
>
> _______________________________________________
> ODE mailing list
> ODE at q12.org
> http://q12.org/mailman/listinfo/ode
>
>
> _______________________________________________
> ODE mailing list
> ODE at q12.org
> http://q12.org/mailman/listinfo/ode
>



More information about the ODE mailing list