On Thu, 28 Jun 2001, Jan Wieck wrote:
>
> On a third thought, you don't get anywhere with longjmp's.
> You have a call stack, do a setjmp() saving the stack
> pointer. Then you call the function, do another setjmp() here
> and do the longjmp() to #1. This restores the saved stack
> pointer, so at the very first time you do any other function
> call (lib calls included), you corrupt the stack frame at the
> current stack pointer position. If you later jump back to
> setjmp() #2 location, you'll not be able to return.
>
> You can only drop stack frames safely, you can't add them
> back, they aren't saved.
True. I withdraw the idea.
See this for a s[l]ick implementation of coroutines in C:
http://www.chiark.greenend.org.uk/~sgtatham/coroutines.html
(essentially a replacement for set of gotos)
Tis ugly, but it should work (tm).