Writing code at system level might mean dealing with different processors' architectures. When doing this, there is one thing that programmers had to take care of by themselves before C++20, which is endianness. Endianness refers to the byte's order in the binary representation of a number. Fortunately, the last C++ standard helps us to enter endian information at compile time. This recipe will teach you how to be aware of endianness and write code that can run on both little- and big-endian architecture.
Dealing with endianness
How to do it...
We'll develop a program that will query the machine at compile time, so that we can make a conscious decision as to how to deal with numbers...