News for hackers. Stuff that matters.
Re:Let's write a setjmp by flohofwoe on Sunday February 12, 2023 @05:36AM (#34761759)
Do the intrinsics allow to load and store registers from and to memory? That's kind of the whole point why assembly is required.

Most cross-platform co-routine libraries I've seens for C or C++ use a small separate assembly file for stack switching on MSVC, so if it's possible to intrinsics, then it's definitely not a well known technique ;)

PS: at least the list of cross-platform intrinsics looks way too high level for a self-rolled setjmp/longjmp: https://learn.microsoft.com/en-us/cpp/intrinsics/intrinsics-...

Re:Let's write a setjmp by megous on Sunday February 12, 2023 @06:41AM (#34762072)
setjmp/longjmp don't switch stacks (they just "move" up the current stack)