News for hackers. Stuff that matters.
Re:Let's write a setjmp by adrian_b on Sunday February 12, 2023 @05:39AM (#34761775)
The more general POV is that "setjmp" defines a continuation and "longjmp" invokes it.

While the most frequent use of explicit continuations is for implementing exceptions, you are right that there are many other programming techniques based on explicit continuations.

Re:Let's write a setjmp by rwmj on Sunday February 12, 2023 @06:26AM (#34762007)
I'm now wondering if anyone has written an actual continuation library in C (ie saving and restoring the whole stack). Is it possible?
Re:Let's write a setjmp by yvdriess on Sunday February 12, 2023 @06:57AM (#34762173)
yes and yes.
Re:Let's write a setjmp by menaerus on Sunday February 12, 2023 @08:19AM (#34762609)
Coroutines are one good example.