r/cpp • u/ReDucTor Game Developer | quiz.cpp-perf.com • Aug 10 '23
The downsides of C++ coroutines
https://reductor.dev/cpp/2023/08/10/the-downsides-of-coroutines.html
91
Upvotes
r/cpp • u/ReDucTor Game Developer | quiz.cpp-perf.com • Aug 10 '23
7
u/14ned LLFIO & Outcome author | Committee WG14 Aug 11 '23
Duff's devices were the old fashioned goto for implementing as-if coroutines in C for a long time. I remember a C preprocessor macro based implementation of C++ coroutines which is nearly drop in semantically identical. It's implemented using a Duff's Device.
Here it is: https://github.com/jamboree/co2. I deployed it into production one place I worked, because C++ coroutines at the time were nearly unusable. It worked surprisingly well, it was easier to debug at that time than C++ coroutines too.