Ok, I may have misunderstood the spec. It says "if the function containing
the invocation of setjmp() has terminated execution in the interim" it is
undefined, but I guess what I was missing is that the function is not
considered to have terminated if you longjmped out of it.

- Alon



On Tue, Jun 10, 2014 at 8:23 PM, Nikos Chantziaras <[email protected]> wrote:

> It's not undefined behavior. You can save stack contexts at any point and
> jump to them. Coroutines and threads can be implemented with this.
>
> Unwinding the stack due to an exception, which only goes up the stack, is
> only one use case of longjmp.
>
>
>
> On 11/06/14 02:06, Alon Zakai wrote:
>
>> You can use longjmp only to unwind the stack. I believe that to jump the
>> in the other direction is undefined behavior, and we don't support it -
>> a very different model would be needed for that.
>>
>> - Alon
>>
>>
>>
>> On Tue, Jun 10, 2014 at 8:07 AM, Stanislav Tsukrov
>> <[email protected]
>> <mailto:[email protected]>> wrote:
>>
>>     Is there a way to jump with longjmp to a setjmp-point outside of the
>>     current stack?
>>
>>     As far I can see longjmp is implemented with exceptions, so the
>>     jump-point must be upwards on the current stack.
>>     Any way to jump "down"?
>>
>>     --
>>     You received this message because you are subscribed to the Google
>>     Groups "emscripten-discuss" group.
>>     To unsubscribe from this group and stop receiving emails from it,
>>     send an email to
>>     [email protected]
>>     <mailto:[email protected]>.
>>
>>     For more options, visit https://groups.google.com/d/optout.
>>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "emscripten-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to