[fpc-pascal] Portable coroutines

Marco van de Voort marcov at stack.nl
Sat Mar 21 23:29:47 CET 2015


In our previous episode, Mark Morgan Lloyd said:
> Efficient implementation of coroutines requires CPU-specific code in the 
> RTL and possibly the compiler. However 
> http://www.chiark.greenend.org.uk/~sgtatham/coroutines.html suggests a 
> way that coroutines can be implemented in a portable fashion in C, how 
> can this be done in Object Pascal?

Seems more an oddity than a system, but it relies heavily on preprocessor
and fallthrough case.

The preprocessor part can be done, just use whatever preprocessor
(maybe even cpp) and then haul the resulting code through fpc.

But there is no fallthrough case (and personally I think that is a good
thing)



More information about the fpc-pascal mailing list