3

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?

moktor
  • 147
  • 3
  • Great question! Let's see what the community has to say. IMHO staying away from virtual functions and exceptions should be pretty much sufficient. – Vorac Feb 06 '14 at 09:44
  • Have you seen this question: http://electronics.stackexchange.com/questions/3343/how-to-become-an-embedded-software-developer The answers don't seem to address your question directly, i.e., doesn't show which C++ features you should focus on, doesn't even mention C++, only C, but they give good advice about the learning process. In any case, what I found most important is to learn by following examples. Study great programs and try and make existing ones more efficient. – Ricardo Feb 06 '14 at 11:03
  • Also note that the question I mentioned above was considered off-topic by the users of this site (as I think so will yours), but it may be still helpful to you. If they close down your question, try and ask it on StackOverflow instead, as your question is more related to programming than electrical engineering and design. – Ricardo Feb 06 '14 at 11:04
  • 1
    @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. – PeterJ Feb 06 '14 at 11:18
  • 1
    @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... – moktor Feb 06 '14 at 12:12
  • 1
    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". – Phil Frost Feb 06 '14 at 12:22
  • Learn the 'normal' C++ language first, but don't dwindle too long on the libraries. Pay attention to templates, the can be the key to efficient yet well-partitioned programs. – Wouter van Ooijen Feb 06 '14 at 15:22
  • I have used a commercial C++ system and the arduino environment. My impression is that they only implement a small amount of C++. You can make a class, but typically only create an instance or two. I have not really seen much sign of memory management so I never get into a create/destroy cycle. I do like the way it encapsulates variables and functions. I am not sure about extensions of classes which might work, I have not tried. So I would say nice but do not set your expectations too high. – russ_hensel Feb 06 '14 at 17:13
  • 2
    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++](http://en.wikipedia.org/wiki/Embedded_C%2B%2B) (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". – Lundin Feb 07 '14 at 10:16

0 Answers0