Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Usage of "stdbool.h" in Embedded systems

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.

like image 691
Geisterfahrer Avatar asked Oct 31 '25 14:10

Geisterfahrer


1 Answers

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.

like image 184
user694733 Avatar answered Nov 03 '25 07:11

user694733



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!