Comment by JoeAltmaier

4 years ago

Oh I understand how it works. I implemented it, in the first POSIX implementation. I just don't get how anybody wants to do that.

Yes, there's the example right there. But it shows the awkwardness immediately - decoding what the f happened by checking a side effect (is pid == 0? wtf?)

How about spoon(handle_connection, ...) or something like that? See how much better?

It makes more difficult to pass context. You have to resort in the classical void * context, that is not handy to use. Or you have to use globals. The fork idea is more elegant to me, it duplicates the program flow execution in place.