3 ms·
I found that computed-goto (https://gcc.gnu.org/onlinedocs/gcc/Labels-as-Values.html https://gcc.gnu.org/onlinedocs/gcc/Labels-as-Values.html) is cleaner than D
by bxparks 7y ago
I found that computed-goto (https://gcc.gnu.org/onlinedocs/gcc/Labels-as-Values.html https://gcc.gnu.org/onlinedocs/gcc/Labels-as-Values.html) is cleaner than Duff's Device for this sort of thing. (It works for clang compiler too.) Take a look at https://github.com/bxparks/AceRoutine https://github.com/bxparks/AceRoutine for an Arduino library that uses computed-goto.
- naasking 7y agoAgreed, definitely more efficient and probably flexible, but two minor downsides: 1. not portable C 2. requires more storage for each continuation (4 bytes vs. 2)