Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Should I use symbolic names like TRUE and FALSE for Boolean constants, or plain 1 and 0?

0
Posted

Should I use symbolic names like TRUE and FALSE for Boolean constants, or plain 1 and 0?

0

It’s your choice. Preprocessor macros like TRUE and FALSE (and, of course, NULL) are used for code readability, not because the underlying values might ever change. It’s a matter of style, not correctness, whether to use symbolic names or raw 1/0 values. (See also questions 5.10 and 17.10.) On the one hand, using a symbolic name like TRUE or FALSE reminds the reader that a Boolean value is involved. On the other hand, Boolean values and definitions can evidently be confusing, and some programmers feel that TRUE and FALSE macros only compound the confusion. (See also question 5.9.) comp.lang.c FAQ list ยท Question 9.5 Q: A third-party header file I just started using is defining its own TRUE and FALSE values incompatibly with the code I’ve already developed. What can I do? A: See question 10.10.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123