
About the only thing it will do quietly is leak memory. Oh, wanted to get cute with pointers or didn't null terminate that char array? Forgot to free up your resources? C will just be over there blurting out garbage and segfaulting. It's endearing in a way, but it requires you get creative and be especially vigilant. Your suspicions are correct.Ĭ is actually an old and fairly short and simple language: it doesn't have the bells and whistles of more modern languages (and to an extent C++, which is also quite old), and as said by pilotInPyjamas, isn't interested in holding your hand. Having said that, you may suspect that C++ is significantly larger than C as a result.

That meaning that nearly everything in C is valid C++ code. So yeah, on that issue: If OP wants to go low level, I'd too, recommend C over C++, but not because of the language but the embedded culture.ĭepends: C++ can be thought of (but should NEVER be used like) OO C. As the lowest common denominator, this is in a way self-sustaining - why provide a better C++ compiler, a C++ example or (shudder!) a complete C++ API if most users day-to-day skills are rooted in a brutalist sector of C?īeing the guy who is called for "can we have a look at this code?" I see a lot that could be expressed in C++ safer, more elegant and conscice and readable, without losing efficiency on a decent compiler.Īnd it's not that the embedded devs don't want to improve, but usually instead of being rewarded, there are more obstacles thrown in their way.Ĭoming form the C++ side, I do think this might be at least partially to blame on how we (used to) teach C++, enumerating complexities as if more features equal more usefulness, and explaining all its quirks with quotes from a standard incomprehensible to mere mortals.


Of the little material I see, a majority of examples, tutorials, FAQs and solutions are low encapsulation, macro-heavy, with microoptimization habits strewn around. Even if there's C++ support, the compiler quality is often insufficient for embedded constraints. Observing the chasm frequently, it seems less the language itself, and more attitude and tool chain.įor the latter, many microcontroller families seem to be stuck with some half-heartedly supported "IDE's" built around some frozen version of some open source compiler.
