Sample Header Ad - 728x90

why are the definition of true and false in stdbool.h the exact opposite from the UNIX programs true and false?

5 votes
5 answers
1580 views
stdbool.h is usually defined as: #define false 0 #define true 1 (Sources: OpenBSD , musl , etc.) whereas the unix program false - which just has a unsuccessful status code, is defined as: int main(int argc, char *argv[]) { return (1); } for completeness, the definition of the unix program true is: int main(int argc, char *argv[]) { return (0); } So clearly, it is the complete opposite of the value of false in stdbool.h. I have used the version from OpenBSD as the version from coreutils is more verbose What is the historical reason to make these different?
Asked by uuu (762 rep)
Mar 25, 2021, 06:36 PM
Last activity: Jul 28, 2022, 05:08 PM