10 ms·
I've been doing embedded systems in C++ since rocks were young, and this is a great summary of what to avoid. I would sure love a good coroutine runtime, and f
by kabdib 3mo ago
I've been doing embedded systems in C++ since rocks were young, and this is a great summary of what to avoid.
I would sure love a good coroutine runtime, and first-class support for defer. You can do these manually, but language/toolchain/debugger support is nice to have.
(Pragmatically, I will be retired by the time they would be useful)
- usrnm 3mo agoA defer is just a dozen lines of code nowadays, if you really need it, but in most cases you don't if you're doing RAII
- AnimalMuppet 3mo agoIn embedded, I like wrapping a class around a set of registers. Nobody else gets to write to that piece of hardware except that class. As far as avoiding things... avoid basically everything you don't need. Don't add language features that don't actually help you, just because they're there. Keep the subset you use small. But pick that subset to match your problem well, rather than out of dogma.
- wglb 3mo agoIt is still a bit amazing to me that it was significantly easier to do coroutines in Sigma 5 assembly and likely most any assembly than in C or C++. Two languages supposedly close to the machine.
- kabdib 3mo agoI have seen a pure C/C++ implementation of coroutines (it used setjmp/longjmp, and memcpy to copy stacks in and out of the native arena). Not the most portable of constructions, but it worked absurdly well. Being able to write "async" code essentially in-line is a superpower.
- wglb 3mo agoAgree but nowhere as easy as what we did https://ciex-software.com/coroutines.html https://ciex-software.com/coroutines.html