Share this article:
C, C++ and the Family Tree
I am interested in programming languages in general and particularly as they apply to embedded systems programming. The most popular programming language for embedded continues to be C. Clearly it offers the capabilities and facilities that most developers need today, but what comes next?
I think we can get some ideas by looking at the genealogy of C – where it comes from and how it relates to other languages …
The first programming was done in assembly language. Actually, that is not true – it was first done in binary. If you have never programmed a computer using switches and lights on the front, you are not a real software engineer. [No, I do not really believe that, but it is essential to understand conceptually what I just said.] For embedded applications, assembler continued to be very widely used until the 1990s, when various high level languages were tried: Pascal, Modular 2, Forth, PL/M and C to name a few. It was C that “won”. C is non-ideal, but satisfactory.
C originates with a language called BCPL, which was developed at Cambridge University in the mid-1960s. BCPL was designed to be a minimalist language – a kind of “high level assembler”. There were no data types – words of data were treated as integers or addresses as appropriate. Programs were written using a block structure which could be traced back to Algol, which is an even older language.
The B language was derived from BCPL, being even more stripped down to minimize memory utilization. It was used for one of the first UNIX implementations. In due course, developments in CPU architecture [notably the DEC PDP11] made the addition of data types to the language attractive. Thus, C was born and UNIX re-written using it.
For some years, the “standard” for the C language was as described in Kernighan in Ritchie’s book. Many compiler vendors extended and “improved” the language in various ways. A number of teams developed variants of C with object oriented capabilities: C with Objects, Objective C [still used in the Apple world] and C++. The last of these has been most successful and is the only one of the three found in embedded contexts.
The ANSI/ISO standard took many years to develop, as it sought to go beyond ratifying K&R C, but instead incorporated numerous extensions and a few features from C++. It got there in the end and is now probably the most widely used language variant, even though there have been more recent standards published.
I suppose there are three current languages that own their origins to C:
- C++, as I already mentioned, which is gaining ground in embedded.
- C#, which is Microsoft proprietary and not really relevant to embedded systems other that Windows CE.
- Java acquires many features and syntax from C and has a place in embedded systems, where user-installed “applications” are supported. But it is not feasible to implement an entire system in the language. For example, it lacks pointers, which are a critical feature.
Colin’s most recent publication, Embedded Software: The Works is available now on the Elsevier Store. Save 30% on his book and other Newnes Press and embedded systems books. Use discount code “STC3014″ at checkout.
About the Author
You can read more about Colin and his work on embedded systems at The Colin Walls Blog at Mentor Graphics here. Connect with Colin online here:
Electronics & Electrical Engineering
Electronics and electrical engineering have practically limitless applications. From power engineering, telecommunications, and consumer electronics to circuit design, computer engineering, and embedded systems, these disciplines form the backbone of our increasingly tech-dependent world. Elsevier’s collection of electronics and electrical engineering content — particularly our Newnes and Academic Press Imprints — encompasses these areas and more. Our books and journals provide fundamental knowledge and practical, up-to-date toolkits for professional engineers and technicians, undergraduate and postgraduate students, and electronics enthusiasts.