logoalt Hacker News

kabdibtoday at 4:41 PM2 repliesview on HN

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)


Replies

usrnmtoday at 4:45 PM

A 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

AnimalMuppettoday at 4:57 PM

In 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.