TRUE and FALSE

Al Dunbar userAKDU at mts.ucs.UAlberta.CA
Wed Sep 5 11:11:05 AEST 1990


In article <5398 at harrier.ukc.ac.uk>, mtr at ukc.ac.uk (M.T.Russell) writes:
>...
 
>To the people complaining about `if (x == TRUE)': YOU ONLY USE `TRUE' AND
>`FALSE' FOR ASSIGNMENT AND PARAMETER PASSING.  It's a fairly simple rule.
>
 
Hear, hear!!!
 
I would hazard a guess at this point that perhaps the reason that
there is so much contention and misunderstanding here  is  simply
that  C  doesn't  have  a 'LOGICAL' (or boolean) type. In certain
contexts, an integral value is taken  by  the  compiler  to  mean
False if zero and True if non-zero. If you were forced to provide
an expression of boolean type, then the  compiler  would  quickly
straighten  everyone out, and 'if (x == TRUE)' would never appear
in a compiled program. The struggle to make it look like it has a
boolean type (such as the macros suggested recently, one of which
expanded to over 200K bytes!!!) are not doing much to add clarity
to  the  situation. Unfortunately, the solution is that we should
all learn the language a little better.
 
-------------------+-------------------------------------------
Alastair Dunbar    | Edmonton: a great place, but...
Edmonton, Alberta  | before Gretzky trade: "City of Champions"
CANADA             | after Gretzky trade: "City of Champignons"
-------------------+-------------------------------------------



More information about the Comp.lang.c mailing list