As far as I could find, the width of the bool type is determined by the implementation. But are there any logical types of fixed width, or should I stick with, for example, uint8_t for a bool representation with a fixed width?
[EDIT] I made this python script that automatically generates a C ++ class that can contain the variables that I want to send between the microcontroller and my computer. The way it works is that it also stores two arrays containing a pointer to each of these variables and the size of each of them. This gives me the necessary information to easily serialize and deserialize each of these variables. For this to work, size, endianness, etc. Variable types must be the same on both sides, since I use the same generated code on both sides. I do not know if this will be a problem, but I do not expect this. I already worked with this chip (32-bit ARM) and had no problems sending integers and float types in the past. However, it will be a few days until I return and can not try the booleans on the chip. This may be a more serious problem later, as this code can be reused on other chips later.
So my question. Is there a fixed-width bool type defined in standard libraries, or should I just use uint8_t to represent a boolean?
source share