|
On most embedded systems you cannot include std. You don't have a decent memory allocator. Bad use of templates will consume all of your flash space (code duplication). Yes, it can work for simple Arduino sketches, and I won't say that there are not complex embedded projects in C++. But... why should I want to use C++? For one, I use a small subset, like it's C with classes. I like function overloading and default argument values, initializing default values for some structs, not having to type typedef struct, the fact that for a time I could declare variables mid-function and using literal bool, true, false, etc. But full-blown C++ on embedded (MCU)? I think I'll pass. |
You would want to use C++ for stronger type safety, proper enumerations, templates instead of undebuggable macros, namespaces,....
https://news.ycombinator.com/item?id=31406942
"CppCon 2016: Jason Turner “Rich Code for Tiny Computers: A Simple Commodore 64 Game in C++17”"
https://www.youtube.com/watch?v=zBkNBP00wJE
MCUs also don't support full-blown C, and it isn't a show stopper to keep advocating it, so why should it be for a language with better safety options, even with constraints.