Technical requirements
To get the most out of this chapter, I strongly recommend using Compiler Explorer (https://godbolt.org/) as you read through the examples. Select GCC as your compiler and target x86 architecture. This will allow you to see standard output (stdio
) results and better observe the code’s behavior. As we are using a lot of modern C++ features, make sure to select the C++23 standard, by adding -std=c++23
in the compiler options box.
Compiler Explorer makes it easy to try out the code, tweak it, and immediately see how it affects the output and generated assembly. Most of the examples can also be run in a Renode simulator on an ARM Cortex M0 target and are available on GitHub (https://github.com/PacktPublishing/Cpp-in-Embedded-Systems/tree/main/Chapter16).