On 2010-12-02, Paul Rubin <no.em...@nospam.invalid> wrote: > Tim Harig <user...@ilthio.net> writes: >>> That's called longjmp. >> >> The problem is that you might have partially allocated data structures >> that you need to free before you can go anywhere. > > Alloca can help with that since the stack stuff gets released by the > longjmp. Alternatively you can have an auxiliary stack of cleanup
alloca() only helps if you actually *want* the data stored on the stack. There are many reasons one might prefer or need that the data in the heap. > longjmp. Alternatively you can have an auxiliary stack of cleanup > records that the longjmp handler walks through. Of course if you do Only if you already have pointers to *all* of the data structures at the point where you put your setjmp(). This approach is error prone. > records that the longjmp handler walks through. Of course if you do > that, you're halfway towards reinventing exceptions. Exactly. -- http://mail.python.org/mailman/listinfo/python-list