3
\$\begingroup\$

In the past I've been using C (or ASM) to develop microcontroller firmware. It's what I learned during my EE studies. It seems though, that the job market here has a high demand for C++ developers in the embedded systems field. Unfortunately I only have very little experience working with C++ and therefore I would have to properly start learning it.

Now, I read through Is C++ suitable for embedded systems? and am aware that C++ (or "C+") is suitable for use in resource-constrained environments, but as a programmer I have to be aware of what language features I can and can not use.

Therefore my question: When learning C++, what language and library features do I have to be aware of? Which features are not suitable to use in a resource constrained environment and which ones are very useful?

\$\endgroup\$
9
  • \$\begingroup\$ Great question! Let's see what the community has to say. IMHO staying away from virtual functions and exceptions should be pretty much sufficient. \$\endgroup\$
    – Vorac
    Feb 6 '14 at 9:44
  • 1
    \$\begingroup\$ @Ricardo, it's not so much off-topic here just too broad / opinion based. On Stack Overflow with the high volume on c / c++ tags I wouldn't really be surprised if it was closed for the same reason in 5 minutes. \$\endgroup\$
    – PeterJ
    Feb 6 '14 at 11:18
  • 1
    \$\begingroup\$ @Ricardo: Thanks for your suggestion. I'll have a look at the question you linked. It looks interesting in any case. I'm aware that it kind of prompts opinion based answers but I thought electrical.stackexchange was the most appropriate forum to ask this question and thought that it wouldn't be closed down as quickly as it probably would on StackOverflow... \$\endgroup\$
    – moktor
    Feb 6 '14 at 12:12
  • 1
    \$\begingroup\$ If you stop at "but as a programmer I have to be aware of what language features I can and can not use" and ask that question, I think this could be reopened. "How do I learn FIELD?" is always too broad, and the answer is always "read stuff and ask good questions". \$\endgroup\$
    – Phil Frost
    Feb 6 '14 at 12:22
  • 2
    \$\begingroup\$ The main problem with C++ in embedded systems is that almost every single compiler has very poor conformance to the standard. They also tend to implement C++ in inefficient ways. Because of this, there was an attempt to create an efficient subset of C++ for embedded systems, called Embedded C++ (or EC++). It took out parts of C++ that compilers typically implement poorly. EC++ might be dead by now, but the same problems with C++ compilers for embedded systems still exists today. So it might be worth checking what EC++ labelled as "bad". \$\endgroup\$
    – Lundin
    Feb 7 '14 at 10:16