TRUE and FALSE

leland.f.derbenwick lfd at cbnewsm.att.com
Fri Aug 31 07:43:49 AEST 1990


In article <11369 at crdgw1.crd.ge.com>,
volpe at underdog.crd.ge.com (Christopher R Volpe) writes:
> In article <2316 at cirrusl.UUCP>, dhesi%cirrusl at oliveb.ATC.olivetti.com
> (Rahul Dhesi) writes:
> |>
> |>When I find somebody who really, really, really wants to define TRUE
> |>and FALSE, even somebody who uses them for assignment only, I recommend
> |>the following defines instead:
> |>
> |>     #define ZERO   0
> |>     #define ONE    1
> |>
> 
> Ugh. Those say nothing. They don't hint to the boolean nature of the
> variables being assigned to. They're as useless as the comments in
> the following code: [deleted]

Am I the only one out here who thought that "Those say nothing" was
_exactly_ the point of the posting?

I saw the ZERO/ONE posting as a parody of the TRUE/FALSE suggestion,
pointing out gently that #defining TRUE and FALSE is about as useful
as ONE and ZERO -- they are hacks for people who don't approve of
the original choice made when the language was invented.

And defining TRUE and FALSE tends to lead, eventually, to some
maintenance programmer who's just (almost) learned C writing

   if (flag == TRUE)

which of course doesn't work at all the way it looks.  (Though I'll
admit it reads well: "if flag is true...")  IMHO, any "improvement"
that would lead a novice into this sort of error is a step backwards.

Of course, this is now the <n+1>st rehashing of this issue in this
newsgroup, and it's essentially become a religious war.

 -- Speaking strictly for myself,
 --   Lee Derbenwick, AT&T Bell Laboratories, Warren, NJ
 --   lfd at cbnewsm.ATT.COM  or  <wherever>!att!cbnewsm!lfd



More information about the Comp.lang.c mailing list