Thought Leadership

Embedded software articles – from incrementing in C/C++ to using dynamic memory

By Colin Walls

In a recent post I mentioned that I have written a lot of articles over the years. I sometimes wonder how many, but it is certainly in the hundreds. Although historically they were in print, nowadays, most of my work appears online. A particular favorite outlet is a popular venue for embedded developers: embedded.com

I have cataloged and highlighted some more of my work …

In due course, I will endeavor to make a post each time an article is published, so that readers can take a look when they are fresh. But, for the moment, I am playing catch-up.

Pre-increment or post-increment in C/C++

Most C or C++ programmers are completely clear about the behavior of the ++ operator [and –] and the result of expressions that employ it. However, what if the return value is unused? Does it matter whether the code uses ++i or i++? This article looks at the finer points of compiler code generation and why that choice might matter.

Do you really need source code?

If you ask any embedded software developer whether they would like access to the source code for the real time operating system that they have selected, the answer would almost certainly be yes. Likewise for any other software IP. This article investigates whether this is a sensible answer in all cases and looks at when and why source code is needed and why sometimes it may be less useful than anticipated.

Useful language extensions for embedded applications

Most people would agree that standardizing programming languages is a good thing, as it leads to portability of software and programming skills. But what if the resulting standard lacks features required for certain types of applications?

Guidelines for handling volatile variables

Use of the C keyword volatile is critical to many embedded software applications, but it is generally not well understood. In addition, a number of compilers do not implement the keyword’s functionality correctly, which compounds the problem. This article provides some guidelines for the use of volatile variables.

Dynamic memory and heap contiguity

Any kind of software needs memory to store data. How much data is stored, how it is accessed, and the processing performed on that data can vary greatly from one application to another.

In a desktop system, the approach to programming assumes that the system has infinite resources (memory) and that human intervention is a possibility. But most embedded applications have limited resources and may be deeply embedded, which means they need to be entirely self-sufficient.

Leave a Reply

This article first appeared on the Siemens Digital Industries Software blog at https://blogs.sw.siemens.com/embedded-software/2014/09/08/embedded-software-articles-from-incrementing-in-cc-to-using-dynamic-memory/