top/contents search

9. Boolean Expressions and Variables

9.1 What is the right type to use for Boolean values in C? Is there a standard type? Should I use #defines or enums for the true and false values?

9.2 Isn't #defining TRUE to be 1 dangerous, since any nonzero value is considered ``true'' in C? What if a built-in logical or relational operator ``returns'' something other than 1?

9.3 Is if(p), where p is a pointer, a valid and portable test?

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

9.5 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?


top

contents search
about this FAQ list   about eskimo   search   feedback   copyright

Hosted by Eskimo North