[ODE] Using exceptions to catch errors
Jon Watte
hplus-ode at mindcontrol.org
Thu Aug 12 09:11:38 MST 2004
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
More information about the ODE
mailing list