Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!samsung!aplcen!haven!adm!smoke!gwyn From: gwyn@smoke.BRL.MIL (Doug Gwyn) Newsgroups: comp.lang.c Subject: Re: A question of style Message-ID: <11743@smoke.BRL.MIL> Date: 5 Dec 89 06:40:47 GMT References: <1989Nov23.170838.10376@phri.nyu.edu> <680014@hpmwjaa.HP.COM> Reply-To: gwyn@brl.arpa (Doug Gwyn) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 27 In article <680014@hpmwjaa.HP.COM> jeffa@hpmwtd.HP.COM (Jeff Aguilera) writes: ->>while (c = getchar(), c != EOF) -Too much annoying white space, conveying no information or structure. Try - while (c=getchar(), c!=EOF) -instead. Pull atomic concepts and actions together. I think most experienced programmers would prefer white space around assignment operators. I prefer whitespace around any infix binary operator. This is not terribly important anyway. ->The standard C idiom for this is -> while ( (c = getchar()) != EOF ) -Gee. I prefer the first construct. Indeed, it is the only one I dare use, -because it is so much clearer. Clarity must be in the eye of the beholder, because many programmers find the standard idiom much clearer: "get a character into`c' and test it against EOF". With the form you prefer, one has to mentally connect the two occurrences of `c' and appreciate that their contents are related. That connection is automatic to the experienced user of the second form. -But I understand (and accept) that most programmers are compelled to -use the K&R form, following their masters' dogma blindly, criticizing -all others. You don't understand shit.