Re: Libification project (SoC)
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Mar 16, 2007, 11:51 UTC
- Message-ID
- <Pine.LNX.4.63.0703161248380.22628@wbgn013.biozentrum.uni-wuerzburg.de>
- In-Reply-To
- <vpqveh15zvn.fsf@olympe.imag.fr>
Hi,
On Fri, 16 Mar 2007, Matthieu Moy wrote:
Show 22 quoted lines
> Johannes Sixt <J.Sixt@eudaptics.com> writes: > > > You could think about longjmp(3)ing out into main(), which would have to > > setjmp(3). But in order to clean up intermediate frames, you would have > > to have a stack of setjmp/longjmp buffers. > > > > Oh, well, how do I *love* them C++ exceptions! > > You can have exceptions in C too. > > I've used it a bit while contributing to Baz 1.x (the fork of tla). > The library used was cexcept ( http://cexcept.sourceforge.net/ ). > > As you mention, jumping is the easy part, and cleaning up is the hard > one. Baz was using talloc, hacked to somehow work with cexcept. The > mini-library doesn't seem to be available as a tarball anymore, so I > did the checkout+targz in case someone's curious to have a look, and > lazy enough not to install baz to get it: > > http://www-verimag.imag.fr/~moy/tmp/talloc-except--2.0.1--patch-2.tar.gz > > This stuff is not supported anymore, but very small anyway.
I was thinking about a similar approach some time ago. But that means that you _must not_ have static variables that you rely on being initialised correctly.
I mean, we have xmalloc(), and it would be easy to enforce xfree(), too (which would be good for memory profiling anyway), and we _could_ hack that into tracking which pointers were returned after which checkpoint.
But we _cannot_ say which static variables should be initialised (and how), after some "exception" was thrown at a certain point.
Ciao, Dscho