Doing C language programming for the 21st century

In the continually evolving world of embedded systems design in the era of ubiquitous connectivity, where no device is an island unto itself, one thing remains constant: the popularity of the C language for use in space and resource constrained applications. One measure of its popularity are the number of contributions on Embedded.com, some of which are included in this week's Tech Focus newsletter. 

While C++ has become popular for consumer mobile and wearable apps and in the enterprise, in both traditional embedded systems and the minimalist IoT environment of MCU-based machine-to-machine and wireless sensor networking, the C language or some variant of it remains king.

But the challenges of new environments mean our tools must be used in new ways and new capabilities must be added. The C language has evolved and a variety of features have been added ad hoc, but the ISO approved standard version of the language has been slow to change. Up until recently the last major revision was C99, in 1999, after which the computing industry, and especially embedded systems, has been turned upside down.

But in 2011 that changed when preliminary implementations of a new version – C11 – were made public with a number of improvements, many in the form of acceptance of features that were found in various compilers already used across a number of platforms, and in its use of better memory models to support multiple threads of execution. C11 has also added five more keywords to the existing 32 in C99 and now includes a number of enhancements:

Multiple threading support
Static assertions
Strict type enforcement
Macros for complex values
Alignment specification
Type generic expressions
Unicode support
Bounds-checking interfaces, and
Anonymous structures and unions

For a variety of reasons, though, C11 has been slow to migrate into embedded applications. Some of you don't want to rock the board: you've finally gotten a handle on the existing version of the language and do not want the uncertainty of what implementing the new standard would involve. Some of you say it is due to the fact that the compiler you use does not support C11. Others look at C11 as a formalization of techniques and methods already implemented ad hoc within the industry in the existing older compilers and do not think it is worth the time and effort to upgrade.

Despite all these rationalizations, Jack Ganssle recently decided to look at the new finalized version of C11 revision in much more detail. He waded through the long, dry prose of the standard's documentation and found a lot to like. He reports on what has got him excited in “Why you need the C standard.

“The C11 standard is over 700 pages. It’s practically unreadable,” he writes. “It is one of the driest and most boring books ever to hit the street, so it's unsurprising so few of us have read it, or even flipped through the pages.”

But he writes that he was pleasantly surprised to find that it is full of valuable information and insights that the more accessible C books seem to miss. One of the things he is most excited about is the amount of attention it devotes to the assert () macro, something he and others have written about extensively on Embedded.com, despite the fact that the last C99 revision said nothing at all about it this important C language feature.

He found a lot more that interested him and feels that it if you can afford it you should pay to get a copy of the new C11 standard, so you will have what he calls a “foundational document” for the work you will be doing in the future.

“As professionals, we all owe it to ourselves, and to our careers, to have easy access to the foundational documents of our industry,” he writes. “And we need to read them!”

Included in this week's Tech Focus Newsletter are a few articles and papers on the C11 standard of which my Editor's Top Picks are:

C11: C finally gets a new standard
C11's ease of use and how it compares with C++
Subtleties of the ANSI-ISO C11 standard

Also included in this week's Tech Focus newsletter are a number of articles and blogs by Jack and other authors on best programming practices relating to commenting, documenting code, clean coding tools, and the use of such powerful C macros as assert(). Another useful resource is Embedded.com’s “Best Programming Practices” archive of articles.

It is easy to forget why you do certain things after you have done them so long they have become automatic. And when dealing with a problem child like the C language, even with its improvements, I find it useful to go back and review the basics. there is so much that is useful in the language but also much that can go wrong. So like pilots on commercial aircraft who constantly go over procedures they already know by heart, it is worth regularly going over the fundamentals of the language and how to use it well.

What tools and techniques do you use to make sure your C code is as efficient and as useful as it can be? Have you looked at C11 and incorporated its many improvements into your current coding? If not, why not? Are there resources you have found on the Web that are helpful? I would like to hear from you and get your perspective. Maybe we can work together to put your experiences into writing to share what you have learned with the rest of the embedded systems developer community.

Embedded.com Site Editor Bernard Cole is also editor of the twice-a-week Embedded.com newsletters as well as a partner in the TechRite Associates editorial services consultancy. If you want to see a calendar of topics for upcoming weekly Tech Focus newsletters or have a topic you would like to see covered on Embedded.com, he welcomes your feedback. Send an email to , or call 928-525-9087.

See more articles and column like this one on Embedded.com. Sign up for s ubscriptions and newsletters . Copyright © 2014 UBM–All rights reserved.

5 thoughts on “Doing C language programming for the 21st century

  1. “If you are looking for the latest C (or C++) spec, go to the ANSI webstore. The document costs only $60 there, as opposed to hundreds at the ISO store. Search for “INCITS/ISO/IEC 9899-2012″”

    Log in to Reply
  2. “The C11 standard published several years ago. I get this news today. I am ashamed much. As a software engineer, and use C language to write code frequently, I think the main reason is that C11 standard need money to purchase. If it is free to download on

    Log in to Reply

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.