Posts Tagged ‘programming languages’

17 October, 2016

What are you priorities when writing code? Obviously you need to implement some specific functionality and there may be a required level of performance. This is all testable or measurable. However, there are two other key goals, that are harder rate:

  1. Write code that is clear and easy to understand. I shy away from using the term “self-documenting”, but that is certainly what you should be aiming for.
  2. Make sure that the code is maintainable and extendible. It might be you that has to do future work and a little care now will make your life easier down the line.

It is #2 that I would like to focus on today … Read the rest of this entry »

, , , , ,

22 August, 2016

It is a given that structured programming – in one form or another – is a Good Thing. For years, the spaghetti of GOTOs that arose in earlier programming languages has been abhorred by all right-thinking programmers. There are good reasons for this attitude. Firstly, structured code tends to be easier to debug and, second, the code is more readable and, hence, maintainable. Both of these are productivity improvements, so the GOTO should clearly be avoided.

But, what about the break statement in C? … Read the rest of this entry »

, , , , ,

13 June, 2016

I have frequently asserted that one of the most important attributes – maybe the most important attribute – of code is readability. This is because an enormous amount of time is spent on debugging and maintaining code – far more than that expended on writing it in the first place. So, keeping the future human reader [who might be you!] in mind at all times is essential.

Interesting challenges occur when you think about hiding text/code from the compiler … Read the rest of this entry »

, , , , , , , , ,

16 May, 2016

Embedded developers often bemoan the fact that no programming language is ideal for their particular needs. In a way, this situation is unsurprising, because, although a great many developers are working on embedded applications, they are still only quite a small subset of the world’s programming community. Nevertheless, some languages have been developed with embedded in mind. Notable examples are PL/M, Forth and Ada, all of which have been widely used, but never universally accepted.

The compromise, that has been adopted almost universally, is C … Read the rest of this entry »

, , , , , ,

9 May, 2016

My latest article at embedded.com has been published:

Pointers and addresses – a programming minefield

0886FFF7-2322-444E-8CDE-6A3EC6B43588Pointers are a very powerful feature of the C language. In a programming language, power is dangerous, as programmer error can have dire consequences. As a result, many developers favor languages, like Java, which do not support pointers and are, hence, “safer”. However, the power of pointers is valued by embedded developers, who accept that they need to understand their subtle nuances. This article looks at the potential issues with pointers and proposes some guidelines to avoiding problems.

I wrote this article because pointers are so important to embedded developers that a clear understanding is absolutely essential. My goal is to simply clarify some of the details that are not of concern to desktop application programmers.

, ,

25 April, 2016

There is a variety of reasons why C is so widely favored as a programming language for embedded software. It is a powerful, expressive and efficient language – these are certainly attractions. But another factor is also important: availability of expertise. C is used very widely outside of embedded, so many programmers know the language. Staffing up an embedded software project should, therefore, be quite straightforward.

However, programming for embedded systems, even if it is in a familiar language, is still different from programming a desktop computer … Read the rest of this entry »

, , ,

2 November, 2015

My latest video blog, where I discuss language standardization and use of language extensions, has just been published and may can be accessed here or here:

Of course, using professional grade development tools, like Sourcery CodeBench from Mentor Embedded helps address these issues fully.

I am very interested in feedback and suggestions for future topics. Do get in touch by email, comment or via social media.

, , ,

27 July, 2015

I have a very strong resistance to the practice of doing something [anything!] just because “it is the way we have always done it”. I love to play Devil’s Advocate [or “Devil’s Avocado” as I heard someone quip the other day] and propose change just to shake things up. It may be that the tried and tested approach is, indeed, the best, but you cannot be sure until you have considered that other options.

When it comes to embedded programming, it is easy – most people use C or similar languages. But is that the only way? … Read the rest of this entry »

, , , , , , ,

20 July, 2015

I am involved in an interesting project, with which I need some help. And that might be where you come in. I had an idea for a book and managed to persuade the inimitable Clive (“Max”) Maxfield to work with me on it. The plan is that he and I will write some sections and jointly edit the whole book. We have an agreement with Elsevier to publish the fruit of our labors, so we are now somewhat committed.

This is why I am now asking for help … Read the rest of this entry »

, , , ,

1 December, 2014

I am continuing my catch-up process of cataloging embedded software articles that I have had published on embedded.com This time they cover the influence of software on power management, using a memory management unit, all about the C/C++ keyword static and the basics of multicore … Read the rest of this entry »

, , , , , , , , , , , ,

1 September, 2014

As I mentioned on a previous occasion, I always welcome questions whenever I make a presentation, do a web seminar, write an article or blog post or whatever. Even very simple queries give me ideas for topics to discuss. I always take the view that, if one engineer poses a question, there are probably a bunch of guys who would also like the answer.

Once again, I am turning my attention to C++ … Read the rest of this entry »

, , , , , , ,

4 August, 2014

I started a couple of weeks ago, when I received an email from Sandeep Vasant from Ahmedabad University in India. For reasons that he has yet to reveal, he was having trouble with some code like this:

int a=10, b=20, c=0;
c = a++ + a++ + b++ + b++ + ++a + ++b;

He tried this with one compiler and the resulting values of a, b and c were 13, 23 and 96 respectively. He was satisfied with this result. Then he tried a different compiler, which yielded a final value for c of 98, which he found confusing.

I started looking into this, certain that the explanation was simple … Read the rest of this entry »

, , ,

28 July, 2014

I often need to do a bit of programming – normally C or C++. I am not generally writing a real software application, as that is not my job, but I often need to produce chunks of code to illustrate a point in an article, presentation or blog post. This code can be anything from a single line to a few dozen. Obviously, all I need to do is create a text file for the code and build it using a suitable toolchain for execution on my PC or for inspection of the resulting assembly language output.

Recently, I was introduced to an interesting alternative … Read the rest of this entry »

, , , ,

14 July, 2014

As I have talked about before, I am particularly interested in programming languages, with a strong focus on embedded, of course. So, I always take a look when I see a survey that looks at what developers are using and what the trends are. When I saw that the IEEE were publishing some results, they really had my attention.

However, all was not what it seems … Read the rest of this entry »

, , ,

7 July, 2014

I have made a number of recent postings focused on C++ issues, responding to a number of questions. I have a few more planned, but I was intending to give this topic a rest for a while. However, my eye was caught by one question, which I felt had some potential:

I learned that Objective C objects are not complete copies of the class object. In other words, only the data and certain static structures are independent for each instance of a class. The methods are kept in a central location for all objects to use. Is there any C++ implementation for embedded systems that use this feature?

This sounds simple, but this question raises quite a few issues … Read the rest of this entry »

, ,

16 June, 2014

Following on from my recent online C++ lecture series, I found that I had a lot of interesting questions from the audience, which I had limited time to answer. It seemed logical to do so here. So this is the first of a number of posts where I will address one or more of these questions. If you have any questions about embedded software [not just C++], please email me and I will do my best to answer them.

For today, there are just 3 C++ related queries … Read the rest of this entry »

, ,

2 June, 2014

Maybe I should apologize for going on about C++ yet again, but, following on from the recent online lecture series that I conducted, I learned that there is a lot of interest in the topic. I also found the experience a very fruitful source of ideas, inspiration and queries – much of this will appear here.

During the lectures, I would periodically pose a question, which the attendees could answer via the chat. An interesting one was: how does a struct differ from a class in C++? … Read the rest of this entry »

, ,

28 April, 2014

A frequent topic for discussion, I have found, both here and elsewhere, is programming languages for embedded development. Every developer has their favorite and has clear ideas on what is going to happen in the future. Market research also indicates certain trends, but, curiously, many of those trends have fallen victim to the innate conservatism of embedded developers. There is a strong “if it ain’t broke, don’t fix it” culture and I am not about to try to change that.

Currently, C is the dominant programming language for embedded. Market research has frequently told us that C++ usage will steadily increase and overtake C sometime soon. I have seen such surveys for about 20 years now and it does not seem to be happening … Read the rest of this entry »

, ,

18 November, 2013

My busy two week conference period is now behind me and, having had a bit of R&R in the meantime, I have had a chance to reflect on some of my experiences and impressions of the three events: ARM TechCon, ECS and IP-SoC.

If you attended any of these events, please email or comment to share your thoughts. If you would like copies of any of my materials, please emailRead the rest of this entry »

, , , , , , , , , , , , ,

@colin_walls tweets

Follow colin_walls