Thought Leadership

Am I going Rusty?

When I go to trade shows and conferences, like Embedded World last week, I do my best to find things to take away. I am not thinking of the ubiquitous give-away items that exhibitors seem so keen to spend money on. I am looking for knowledge and ideas …

I usually scan the conference program and figure out which streams are of interest – often they are the ones that I am also presenting in. I then select a few talks to attend, paying particular attention to those that occur in adjacent times to my own. I also check who the presenters are, as I know quite a few people in the business and can guess who might have the most to offer me!

At Embedded World I did a number of presentations, a couple of which were in a stream largely dedicated to MISRA C. I made an initial, scene-setting presentation, reviewing embedded programming languages. Next up was Niall Cooling from Feabhas, who was introducing the Rust programming language. This sounded interesting, so I settled down to learn something …

I thought that it would be useful to share my impressions and, to make it interesting [for me] I decided to not take notes and avoid looking at the presentation slides after the talk. I wanted to see what had lodged in my memory. 🙂

Broadly, Rust is designed to be a general purpose programming language, which is fairly compact and has much of the expressiveness of C, but without many of the pitfalls. Although there is some cost in terms of memory/performance because of the runtime system, Rust enables the development of safe, maintainable code much more readily than C; a very large number of MISRA C guidelines would be rendered redundant if Rust were to be adopted.

Here are some key facts that I think I learned about Rust:

  • All objects have minimum scope by default. i.e. a variable is local unless you explicitly make it global.
  • Rust does not use pointers, but has references that do much of the same job, but are safer.
  • Calling C code from Rust and vice versa is possible, thus enabling the use of legacy code.
  • If some dubious code is needed, which is not restricted by the rules of Rust, a specific block may be designated as “unsafe”.

There is, of course, much, much more. From this short introduction, I was convinced that I should give the language a try. Seeing that it has been adopted by some of the biggest names in the software industry, I think it likely that this is not my last word on the topic.

Colin Walls

I have 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, I am a member of the marketing team of the Mentor Graphics Embedded Systems Division, and am based in the UK. Away from work, I have a wide range of interests including photography and trying to point my two daughters in the right direction in life. Learn more about Colin, including his go-to karaoke song and the best parts of being British: http://go.mentor.com/3_acv

More from this author

Leave a Reply

This article first appeared on the Siemens Digital Industries Software blog at https://blogs.sw.siemens.com/embedded-software/2020/03/02/am-i-going-rusty/