C Style
Karl Heuer
karl at haddock.ISC.COM
Mon Apr 25 07:47:40 AEST 1988
In article <20126 at think.UUCP> barmar at fafnir.think.com.UUCP (Barry Margolin) writes:
>Nowhere does the C language specify that any particular non-zero value
>should be returned by the isXXX functions to indicate truth.
This is correct according to historical precedent and the Jan88 dpANS. I
disapprove nevertheless.
>I can think of one reason, however, why 1 should be used as a standard
>truth value. Single-bit fields ...
I think a more important reason is that the boolean operators such as "<" and
"&&" are already guaranteed to return normalized boolean values (i.e. truth is
denoted by 1). Requiring the isXXX functions to do likewise would follow the
principle of least astonishment.
Karl W. Z. Heuer (ima!haddock!karl or karl at haddock.isc.com), The Walking Lint
More information about the Comp.lang.c
mailing list