Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!sysauto!olu From: olu@sysauto.UUCP (Olumide O. Emuleomo) Newsgroups: comp.lang.c Subject: Re: TRUE and FALSE Summary: Defining TRUE and FA:SE Message-ID: <183@sysauto.UUCP> Date: 5 Sep 90 21:39:35 GMT References: <11215@alice.UUCP> <514@demott.COM> <2316@cirrusl.UUCP> <2341@cirrusl.UUCP> Organization: Systems Automation, Inc Lines: 51 In article <2341@cirrusl.UUCP>, dhesi%cirrusl@oliveb.ATC.olivetti.com (Rahul Dhesi) writes: > I was brash enough to suggest > > But in fact my suggested definitions are much more useful than the > common recommendation of defining TRUE and FALSE. > > No matter how careful the original programmer is, sooner or later > somebody will come along and, noticing that TRUE means true, will try > to do something like: > > i = isdigit(c); > ... > if (i == TRUE) ... > > Of course, defining ONE and ZERO is fairly silly. But defining TRUE > and FALSE is quite risky. I'll take fairly silly over quite risky any > day. > -- > Rahul Dhesi > UUCP: oliveb!cirrusl!dhesi TRUE and FALSE were never meant to be tested explicitly. Good programming practise demands that they be used somewhat as follows if( keyword_found(fname) ) { etc... etc... etc.. } keyword_found(char *fname_param) { switch(foo) { case FAILURE: etc... return(FALSE); case SQLNOTFOUND: more etc.. return(FALSE); etc... } return(TRUE); } Cheers --olu@sysauto.UUCP