Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Usage of comma operator

Path: gmdzi!unido!mcsun!uunet!ksr!jfw
From: j...@ksr.com (John F. Woods)
Newsgroups: comp.lang.c,comp.lang.c++
Subject: Re: Usage of comma operator
Message-ID: <5598@ksr.com>
Date: 24 Sep 91 17:55:37 GMT
References: <1991Sep19.022147.16089@msuinfo.cl.msu.edu> <1991Sep19.053910.2431@uokmax.ecn.uoknor.edu> <robtu.685300138@mexia> <1991Sep24.112428.23020@odin.diku.dk>
Sender: n...@ksr.com
Lines: 24

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>constructs:
>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?
>Consider this:
>	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:

Right.

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.