Thursday December 27, 2007
Coroutines in C: "So each time the decompressor emits another character, it saves its program counter and jumps to the last known location within the parser - and each time the parser needs another character, it saves its own program counter and jumps to the location saved by the decompressor. Control shuttles back and forth between the two routines exactly as often as necessary."
I would describe this interesting (and dirty) programming trick as "How to implement yield in plain C. Worth a read.