Open side-bar Menu
 Embedded Software
Colin Walls
Colin Walls
Colin Walls has over thirty years experience in the electronics industry, largely dedicated to embedded software. A frequent presenter at conferences and seminars and author of numerous technical articles and two books on embedded software, Colin is an embedded software technologist with Mentor … More »

C, C++ and the family tree

 
August 15th, 2014 by Colin Walls

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.

family tree

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.

C is at the heart of a family tree of languages and every embedded programmer should have at least a passing familiarity with it. I just wonder what will come next …

5 Responses to “C, C++ and the family tree”

  1. Avatar John Swan says:

    Thanks Colin. I was very happy to have taken the initiative to learn C and C++ including object oriented methodology before I learned an HDL. So when I learned VHDL I was happy to see some of object oriented capability, like overloading. And of course standard type definition for signals which Verilog didn’t have. And well before that it was doing assembly (incl octal for machine code!) for guess what. PDP-8 with its 12 bit instruction and 4K page limit! PDP-11 architecture was a big leap forward from that.

  2. Colin Walls Colin Walls says:

    John: I, too, started out on PDP-8. I still have the manuals.

  3. Avatar Curtis White says:

    Not disputing the use of C# as an embedded language, but it is not true that it is Microsoft-proprietary. There is an ECMA standard for it and the Common Language Infrastructure (CLI); there are open-source and cross-platform implementations available (e.g. Mono). And since you can use pointers (in “unsafe” mode), it is perhaps a better candidate than Java. However, both C# and Java use the JIT (just-in-time) compilation model and this is much more a restriction for use in embedded systems. Now you can force pre-compilation, and use other tricks, but these languages simple aren’t intended to be used in embedded systems.

  4. Avatar Peter Bushell says:

    Here’s a copy of something I posted on LinkedIn:

    Oh for a language which has the rigour of Ada but which retains much of the OO and low-level flexibility of C++ One which has the brace-free syntax of Python, and a single, non-negotiable style (based on indents). One which can be parsed under BNF rules. One which is suitable for real-time programming, without any dangerous bells and whistles. In short, one which can be used with confidence in really real-time systems, including safety-critical ones, and which does not leave any scope or provide any temptation for its users to waste time devising coding standards or engaging in style wars.

Logged in as . Log out »




© 2024 Internet Business Systems, Inc.
670 Aberdeen Way, Milpitas, CA 95035
+1 (408) 882-6554 — Contact Us, or visit our other sites:
TechJobsCafe - Technical Jobs and Resumes EDACafe - Electronic Design Automation GISCafe - Geographical Information Services  MCADCafe - Mechanical Design and Engineering ShareCG - Share Computer Graphic (CG) Animation, 3D Art and 3D Models
  Privacy PolicyAdvertise