C++17’s Useful Features for Embedded Systems -- Çağlayan Dökme
Recently, our team at Meteksan Defense is upgrading its development environment to use newer versions of many tools and programming languages. One of the more difficult transitions has been the upgrade of our C++11 code base to C++17 for our embedded applications.
In this article, I will be showing some features of C++17 that can also be helpful in the embedded world.
C++17’s Useful Features for Embedded Systems
by Çağlayan Dökme
From the article:
C++14 had smaller upgrades compared to the ones we saw when migrating to C++11 from C++03. Hence, there are only a few features in C++14 that you can use in an embedded system.
Binary Literals
If you are frequently dealing with bitwise operations and modifying registers, you will love these literals. Some compilers had extensions that support such literals, but now they have a place in the actual standard.
uint8_t a = 0b110; // == 6 uint8_t b = 0b1111'1111; // == 255Constraint relaxed constexpr**
With C++14, the syntax you can use in a constexpr function is expanded. Check out this post on StackOverflow. The constexpr is beneficial in the embedded world since...

Suppose you want to write a template function that accepts any specialization of
I continue my journey with concurrency patterns in today's post. The Thread-Safe Interface fits very well when the critical sections are just objects.
Fold expressions exist in C++ since C++17 and significantly affect how we treat variadic templates. Back in the day, I wrote about
Locking is a straightforward idea to protect a critical section. A critical section is a section of code that, at most, one thread can use at any time.
C++ allows us to declare various forms of non-local objects: they usually live throughout the execution of the whole program. In this article, we’ll look at global variables, dynamic, and thread-local objects. We’ll also consider new features for safe initialization C++20.
If you don’t share, no data races can happen. Not sharing means that your thread works on local variables. This can be achieved by copying the value, using thread-specific storage, or transferring the result of a thread to its associated future via a protected data channel.