Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!sun-barr!newstop!texsun!convex!sushi!grogers From: grogers@sushi.uucp (Geoffrey Rogers) Newsgroups: comp.lang.c Subject: Re: A question of style Message-ID: <3552@convex.UUCP> Date: 1 Dec 89 00:51:53 GMT References: <547@mars.Morgan.COM> <1989Nov30.001947.14883@aqdata.uucp> Sender: usenet@convex.UUCP Reply-To: grogers@convex.COM (Geoffrey Rogers) Organization: Convex Computer Corporation, Richardson, Tx. Lines: 24 In article <1989Nov30.001947.14883@aqdata.uucp> sullivan@aqdata.uucp (Michael T. Sullivan) writes: >From article <547@mars.Morgan.COM>, by amull@Morgan.COM (Andrew P. Mullhaupt): >while (c = getchar(), c != EOF) >{ > ... >} > >I posted this instead of mailing it to see what, if any, reaction it got. >I'm always interested in coding style. In this case I would write the above as: while ((c = getchar()) != EOF) { ... } IHMO this is much clearer then the above. In general the only places I have found to use the comma operator is either in for-statements, macros and maybe within expressions of ? : expression. Geoffrey C. Rogers "Whose brain did you get?" grogers@convex.com "Abbie Normal!" {sun,uunet,uiucdcs}!convex!grogers