Comparison with False - something I don't understand

Tim Harig usernet at ilthio.net
Thu Dec 2 13:51:48 EST 2010


On 2010-12-02, Paul Rubin <no.email at nospam.invalid> wrote:
> Tim Harig <usernet at 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.



More information about the Python-list mailing list