by lixiasky · 9mo ago · 0 comments
It's easier in C and old C++ if one can drop down to assembly to switch between different call stacks.
Among modern languages there is Lua. Take a look at Felix too.
Also, do you use ChatGPT to frame your responses ? Nothing wrong if you do, but people might notice the tone and wonder.
https://www.chiark.greenend.org.uk/~sgtatham/coroutines.html
Thanks for the reference—I learned a lot from his work. His use of macros to hide the switch statement is basically the spiritual ancestor of co_await. It is wild to think that C++20 essentially standardized that exact pattern, just moving the "state machine generation" from the preprocessor hacks to the compiler itself.