-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 9-Jun-06, at 5:23 PM, [EMAIL PROTECTED] wrote:
sure you can. sysfatal calls _sysfatal to do the deed. redefine
that to call your
fancy cleanup routine and you're golden.
But it's one step worse than this. Sometimes your fancy cleanup
routine can't dig itself out of your current callstack; it's better
to find a way to "succeed" and handle the failure higher up, thus
maintaining integrity. When I have critical (well, as critical as it
gets when doing entertainment software) resources whose allocation
failure will cause grief, I try to pre-allocate before doing
something irreversible. The the rest of the work is working out what
you're going to use to propagate that exception condition up the
stack, at the same time as your routine "succeeds".
A longump or function call doesn't let you clean up/repair your
state well enough precisely because calling it threw away an
important part of your state. This is what all those people on about
C++ exceptions are mumbling about, although their implementation
means catching every such case in what seems like every codepath -
ugly fast.
Paul
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (Darwin)
iD8DBQFEihUqpJeHo/Fbu1wRAh0KAJwPCzxloDdoK8R61nHASUBvYahb/wCgtetN
9AaBLhds/5qTrx4hAdoicc4=
=BXDh
-----END PGP SIGNATURE-----