Using EH from C
Stelios Xanthakis
sxanth@ceid.upatras.gr
Sun May 2 09:17:00 GMT 2004
On Sat, 1 May 2004, david daney wrote:
>
> I would setjump and set an attfibute(cleanup(function))
> at the catch point, and then longjump from the cleanup function.
>
Not a bad idea. Like this?
if (setjmp (&context)) {
struct pseudo_object X __attribute__((cleanup(pdtor)));
X.normal_termination = 0;
X.ctx = &context;
/* ... */
X.normal_termination = 1;
} else {
}
And pdtor() will either just return or longjmp to ctx depending
on normal_termination.
There's still a minor cost but I guess it's ok.
Thanks,
Stelios
More information about the Gcc
mailing list