Path: utzoo!utgpu!watserv1!watmath!att!dptg!ulysses!andante!alice!ark From: ark@alice.UUCP (Andrew Koenig) Newsgroups: comp.lang.c Subject: TRUE and FALSE (was: NULL as a string terminator) Message-ID: <11215@alice.UUCP> Date: 20 Aug 90 23:02:46 GMT References: <24141@megaron.cs.arizona.edu> <134@blekko.UUCP> <12249@netcom.UUCP> Organization: AT&T Bell Laboratories, Liberty Corner NJ Lines: 36 In article <12249@netcom.UUCP>, ergo@netcom.UUCP (Isaac Rabinovitch) writes: > On the other hand, you can say (and I used to) that using 1 and > 0 instead of TRUE and FALSE is a similar "familiar practice", since any > competant C programmer knows that C booleans are just integers. > In this case it probably makes a big difference that TRUE and FALSE are > ordinary English words, not obscure acronyms. Unfortunately, using TRUE and FALSE opens a great gaping hole: one would expect that x == TRUE would mean the same as x != FALSE but of course it doesn't -- at least not if you use the usual C convention that 0 is false and any other value is true. > I recently came up against a similar clash of "familiar concepts" in > C. People were arguing (was it in this group?) over why programmers > use "i" instead of "i == 0". Well, for one thing, if (i) foo(); and if (i == 0) foo(); mean precisely the opposite of each other. :-) -- --Andrew Koenig ark@europa.att.com