Re: Libification project (SoC)

Previous thread: [PATCH/RFC] Documentation: git-daemon inetd configuration fix by Matthias Kestenholz on Friday, March 16, 2007 - 3:54 am. (3 messages)

Next thread: Re: [PATCH] git-fetch, git-parse-remote: Cleanup implementation of '.' by Junio C Hamano on Friday, March 16, 2007 - 5:32 am. (3 messages)
To: <git@...>
Date: Friday, March 16, 2007 - 4:06 am

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!

-- Hannes

-

To: <git@...>
Date: Friday, March 16, 2007 - 4:58 am

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
-

To: Matthieu Moy <Matthieu.Moy@...>
Cc: <git@...>
Date: Friday, March 16, 2007 - 7:51 am

Hi,

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

-

Previous thread: [PATCH/RFC] Documentation: git-daemon inetd configuration fix by Matthias Kestenholz on Friday, March 16, 2007 - 3:54 am. (3 messages)

Next thread: Re: [PATCH] git-fetch, git-parse-remote: Cleanup implementation of '.' by Junio C Hamano on Friday, March 16, 2007 - 5:32 am. (3 messages)