From: Matthieu Moy Date: Fri, 16 Mar 2007 08:58:04 GMT Subject: Re: Libification project (SoC) Message-ID: In-Reply-To: <45FA501B.FA5B9F30@eudaptics.com> Johannes Sixt 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. -- Matthieu