Message from discussion Usage of comma operator
From: j...@ksr.com (John F. Woods)
Subject: Re: Usage of comma operator
Date: 24 Sep 91 17:55:37 GMT
References: <1991Sep19.firstname.lastname@example.org> <1991Sep19.email@example.com> <robtu.685300138@mexia> <1991Sep24.firstname.lastname@example.org>
j...@diku.dk (Anders Juul Munch) writes:
>ro...@itx.isc.com (Rob Tulloh) writes:
>spcol...@uokmax.ecn.uoknor.edu (Steve Coltrin) writes:
>>la...@lobster.cps.msu.edu (Mark M Lacey) writes:
>Mark>I was wondering why it seems that the comma operator is so rarely used.
>Mark>The only time I ever see it is in 'for' loops. Is it really considered
>Mark>*that* bad by the programming public at large? Any comments?
>Rob>Well, I hadn't seen it used much either outside of the for loop, but
>Rob>in Plaugher's latest book I discovered quite a few of the following
>Rob> if (condition)
>Rob> var = value, anothervar = anothervalue;
>Rob>This does away with the need for braces. I am tempted to use this myself
>Rob>unless someone has a good point agains using this style. Opinions anyone?
> if (condition)
> var = value; anothervar = anothervalue;
>Only one little dot is changed, but the meaning is quite different. In other
>words, using the comma operator like that makes it harder to read:
Always code as if the guy who ends up maintaining your code will be a
violent psychopath who knows where you live. Code for readability.