Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!ucsd!chem.ucsd.edu!tps From: tps@chem.ucsd.edu (Tom Stockfisch) Newsgroups: comp.lang.c Subject: Re: A question of style Message-ID: <621@chem.ucsd.EDU> Date: 10 Dec 89 05:52:48 GMT References: <1989Nov23.170838.10376@phri.nyu.edu> <680014@hpmwjaa.HP.COM> <257E97F4.24962@ateng.com> Reply-To: tps@chem.ucsd.edu (Tom Stockfisch) Organization: Chemistry Dept, UC San Diego Lines: 36 In article <257E97F4.24962@ateng.com> chip@ateng.com (Chip Salzenberg) writes: >According to jeffa@hpmwtd.HP.COM (Jeff Aguilera): >>I understand (and accept) that most programmers are compelled to use the K&R >>form, following their masters' dogma blindly, criticizing all others. >A construct's being quickly identifiable by most C programmers makes that >thing immediately preferable to an equivalent but less common construct. >And if there's one book a C programmer has almost certainly read, it's K&R. I think the point here is that style evolves, and wouldn't if people never strayed from K&R. For instance, what if I justified my use of while (*s++ = *t++) ; by quoting K&R (I p. 101, II p. 106)? >The general rule I adhere to most strictly is: "Repetition is evil." >... The expression >"c=getchar(), c!=EOF" is harder to read than "(c = getchar()) != EOF" for >the same reason. Perhaps it is just because I have never learned lisp, but what *I* find most difficult to read are multiple sets of parentheses. Even though I have never used Jeff's form before in a "while" construct, I still found it easier to read than the "standard" notation. The repetition is just one character here ("c"), and very close by. Am I the only person who is slowed down by lots of parentheses? Just in case what I have said so far doesn't generate any flames, I'll offer what I would write for this case: for ( c = getchar(); c != EOF; c = getchar() ) -- || Tom Stockfisch, UCSD Chemistry tps@chem.ucsd.edu