But relational operators that _create_ booleans --- ==, !=, <, >, et al --- create 0 or 1, strictly.
Indeed, that is specified in the ANSI C standard.
However, I am an advocate of use booleans as booleans. Utilizing the fact boolean is int in C seems nifty but obscures the readability.
I always frowns at statements such as if (fopen(...))...
I prefer the usage:
if (NULL != fopen(...))...
It is only a few more typings. There is no difference in the produced binary but the latter made it very clear that fopen returns integer and we are testing whether it is NULL. In case fopen returns -1 on error, the latter only need change NULL to -1. My point is the latter creates consistency, which eases reading.
-- Hui Zhou -- http://linuxfromscratch.org/mailman/listinfo/lfs-chat FAQ: http://www.linuxfromscratch.org/faq/ Unsubscribe: See the above information page
