Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!rutgers!mit-eddie!uw-beaver!tektronix!teklds!zeus!tekla!dant From: dant@tekla.TEK.COM (Dan Tilque;1893;92-789;LP=A;608C) Newsgroups: comp.lang.c Subject: Re: Writing readable code Message-ID: <1941@zeus.TEK.COM> Date: Tue, 30-Jun-87 03:43:53 EDT Article-I.D.: zeus.1941 Posted: Tue Jun 30 03:43:53 1987 Date-Received: Sat, 4-Jul-87 22:49:37 EDT References: <13008@topaz.rutgers.edu> Sender: rogers@zeus.TEK.COM Reply-To: dant@tekla.UUCP (Dan Tilque) Organization: First National Security Trust Bar and Grill Lines: 43 Ron Natalie writes: >I have always wondered why people think NULL is more mnemonic than 0. NULL is more mneumonic than 0 because it's easy to confuse 0 (zero) with the letter O. On many printers and some terminals it's impossible to tell them apart without close comparison with a known zero. Since it's bad form to use a variable named O, and the compile will give a warning if you use an undeclared variable, this may not be a problem. However, I suspect that some of the early compilers did not give a warning and just defaulted the letter O to an int. I know this is (was?) a common problem in FORTRAN. > I also wonder about people who define TRUE to be any >thing, since it leads to things like > if( bool == TRUE ) >which is different than > if(!bool) I thought that TRUE and FALSE should be: #define FALSE 0 #define TRUE !FALSE With these #defines the above two statements are equivalent. > >Generally, I use !p when I'm dealing with things that are supposed >boolean values like > > if(!isdigit(c)) It's often easy to miss a single character (especially one that doesn't stand out like the "!") when quickly scanning code. if (isdigit(c) == TRUE) will compile to the same object code on almost every compiler and is easier to grasp immediately. The fact that it's positive logic also makes it easier. --- Dan Tilque dant@tekla.tek.com