Last month, I reviewed 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. 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 16bit 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 16bit 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.
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 64bit 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 16bit processors, and their numbers have been gradually declining. If programmers recognized the benefits of using C++ for programming 32- and 64bit 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.
文章评论(0条评论)
登录后参与讨论