logoalt Hacker News

jonathrgtoday at 1:11 PM1 replyview on HN

You definitely need discipline to use C++ in embedded. There are exactly 2 features that come to mind, which makes it worth it for me: 1) replacing complex macros or duplicated code with simple templates, and 2) RAII for critical sections or other kinds of locks.


Replies

kevin_thibedeautoday at 6:37 PM

Consteval is great for generating lookup tables without external code generators. You can use floating point freely, cast the result to integers, and then not link any soft float code into the final binary.