I am reading about the C-coding style for embedded systems and I found the following statement:
Do not use stdbool.h library. Use 1 or 0 for true or false respectively
This statement was written in the following source: https://github.com/MaJerle/c-code-style
However, there is no explanation why to use it or any advantage/ disadvantage in adopting such style.
I would like to know if there is any advantage in using 1 or 0 instead of true or false.
I would like to know if there is any advantage in using 1 or 0 instead of true or false.
There isn't. Using stdbool.h in embedded system is fine.
Note that stdbool.h might not be available on older compilers, but that cannot be the reason because guide you linked also recommended stdint.h types (which in itself is a good advice). And besides, you shouldn't be using outdated compilers.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With