Re:C#’s async/await compared to protothreads in C++
by benhoyt on Monday November 12, 2012 @02:47PM
(#4774412)
Yes, they're a hack, but this is HACKer News, right? :-) More correctly, though, as Adam pointed out, the switch statement implementation of protothreads is a hack.
However, I'd like to also point out that it's a very useful hack. In the tiny embedded micros I work with, something like CPC would be much too heavy weight. Protothreads take 2 bytes of RAM per "thread", and you can even get that down to 1 byte if you use __COUNTER__ instead of __LINE__. Protothreads also have the huge advantage of working in regular C and C++, meaning standard tools just work.
However, I'd like to also point out that it's a very useful hack. In the tiny embedded micros I work with, something like CPC would be much too heavy weight. Protothreads take 2 bytes of RAM per "thread", and you can even get that down to 1 byte if you use __COUNTER__ instead of __LINE__. Protothreads also have the huge advantage of working in regular C and C++, meaning standard tools just work.