On 02/12/2010 18:09, Paul Rubin wrote:
MRAB<pyt...@mrabarnett.plus.com>  writes:
When writing the C code for the new regex module I thought that it
would've been easier if I could've used exceptions to propagate errors
and unwind the stack, instead of having to return an error code which
had to be checked by the caller, and then have the caller explicitly
return an error code to /its/ caller.

That's called longjmp.

The problem with that is that the caller might have to do some tidying
up, such as deallocation.

Exceptions give the caller the chance of catching it (ideally in a
'finally' block), tidying up, and then propagating.

Automatic garbage collection would also have been nice.

alloca might help.

I didn't know about that.

It looks like that's allocated on the stack, and the allocation I'm
talking must be on the heap, so it's not suitable anyway.
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to