It's not the processor
Although over two thirds of embedded systems developers are programming 32- and 64-bit processors, C is surprisingly still more commonly used than C++.
Last month, I looked at the data on programming language usage from the past 14 years of reader surveys by the publisher of Embedded Systems Programming (ESP) and Embedded Systems Design (ESD) magazines (see Saks, Dan, "Unexpected trends," Embedded Systems Design, May 2012, p. 31. www.eetimes.com/4372180.) The data appears to indicate that, although the surveyed readers expected to program less in C and more in C++, just the opposite happened. From 2005 to 2012, the percentage of programmers reporting that their project was written mostly in C rose from around 51% to 65%, while those reporting that their project was written mostly in C++ dropped from around 28% to 20%. I invited readers to speculate on the reasons for this trend. And they did.
One interesting conjecture was that processor choice has driven language choice. More specifically, the 8- and 16-bit processors that dominate the embedded market limit the size of the applications they can support and thus diminish the advantages of using C++ instead of C. The features that C++ adds to C, such as classes, namespaces, virtual functions and templates, are mostly for large-scale applications. For smaller applications running on 8- and 16-bit processors, developers find that C is good enough and thus have little incentive to use C++.
Interesting theory. It intrigued me enough to go looking for some data to confirm or deny it. I didn't have to look far. The ESP/ESD reader surveys had asked readers to identify their current embedded project's main processor. The survey responses from the last eight years appear in Table 1 and also in Figure 1.
Click on image to enlarge.
Click on image to enlarge.
These percentages don't indicate processor market share. Rather, they indicate the percentage of developers who are writing code for each different-sized processor. This is appropriate because we typically measure a programming language's market share by the number of programmers using that language rather than the number of processors running programs written in that language.
The data indicates that over two-thirds of all embedded programmers are writing code for 32- and 64-bit processors, and their numbers have been going up pretty steadily. On the other hand, less than a third of all embedded programmers are targeting 8- and 16-bit processors, and their numbers have been gradually declining. If programmers recognized the benefits of using C++ for programming 32- and 64-bit chips, I think we'd be seeing an increase in C++ use. But we're not.
C++ is losing market share among embedded developers for other reasons. I expect to consider other possibilities in the future.
Dan Saks is president of Saks & Associates, a C/C++ training and consulting company. For more information about Dan Saks, visit his website at www.dansaks.com. Dan also welcomes your feedback: e-mail him at email@example.com..