In a recent blog, a new embedded systems developer asked for advice about when to use C and when to use C++. This question captures the dilemma that even the most experienced programmers face at some point.
The responses to his blog question in general suggest using the two in combination on an as needed basis, selectively using features that help you and ignoring the ones that give you problems.
While such an in-between solution may be appropriate in deeply embedded 8-, 16-, and 32-bit MCU designs, several trends may force developers to leap with both feet into the C++ camp. This is especially so if you are an embedded developer who is also looking to broaden his or her spectrum of professional opportunities, beyond just those control-oriented applications appropriate to traditional C programming.
For one thing, there are the many embedded consumer and network designs created by teams of developers with millions of lines of code that need the sophisticated object-oriented and reuse features of C++. And then there is the shift to the use of C++ or a variant in multicore programming . Some recent articles on embedded.com on this topic include:
In addition, in system level SoC circuit design there is the increasing use of C++ extensions such as SystemC to mimic the parallel operations inherent in such gate level HDLs such as Verilog and VHDL. Recent articles on embedded.com on this topic include:
Finally, in a variety of industrial wireless M2M and sensor apps, MCUs will be interfacing to enterprise servers and networks, where C++, and not C, is the programming language of choice.
To help you assess which language to use in a particular design and/or broadened your knowledge of broader professional opportunities, a number of design articles are available on Embedded.com to will help you make informed decisions about C++, and once you have made the shift, they will help you learn more about this more complicated – and more powerful – extension to C. A particular favorite of mine is “Dive in to C++ and survive .” Other articles I can recommend include:
I have also included some columns from Dan Saks , who has waged a decades-long struggle to bring C++ into the mainstream of embedded systems program. Some recent columns that I have found particularly informative include:
Good reading!! Let’s hear from you on line at Embedded.com or by contacting me directly with your ideas and responses. (EET/Embedded.com Editor Bernard Cole, , 928-525-9087 )