Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!rutgers!topaz.rutgers.edu!ron From: ron@topaz.rutgers.edu.UUCP Newsgroups: comp.lang.c Subject: Re: Writing readable code Message-ID: <13008@topaz.rutgers.edu> Date: Mon, 29-Jun-87 11:46:12 EDT Article-I.D.: topaz.13008 Posted: Mon Jun 29 11:46:12 1987 Date-Received: Tue, 30-Jun-87 04:23:16 EDT References: <1158@copper.TEK.COM> <6858@auspyr.UUCP> <17171@cca.CCA.COM> <22250@sun.uucp> <17193@cca.CCA.COM> Organization: Rutgers Univ., New Brunswick, N.J. Lines: 40 I have always wondered why people think NULL is more mnemonic than 0. When I read them as exactly the same (and fortunately in C, they are defined to be). 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) Generally, I use !p when I'm dealing with things that are supposed boolean values like if(!isdigit(c)) and comparison to zero for things that are supposed to be returning a value if( malloc(100) == 0 ) MY PET PEEVES: 1. Comparing error returns from UNIX syscalls to be less than zero. UNIX system calls that return ints, are usually defined to return -1 on error. It drives me crazy to see code test for less than zero. It doesn't say returns negative value on error, it says -1. 2. Needless use of the comma operator and parenthesis to demonstrate manhood to the obliteration of code readability, e.g. if((fd=open("foo",1)<0) SCREW this, too difficult, how about writing the code to indicate what is going on: fd = open("foo", 1); if(fd == -1) -Ron