Xref: utzoo comp.unix.questions:12950 comp.lang.c:17735 Path: utzoo!dptcdc!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!ernie.Berkeley.EDU!jas From: jas@ernie.Berkeley.EDU (Jim Shankland) Newsgroups: comp.unix.questions,comp.lang.c Subject: comma operator: keep away? Message-ID: <28831@ucbvax.BERKELEY.EDU> Date: 18 Apr 89 16:41:38 GMT References: <10007@smoke.BRL.MIL> <498@lakart.UUCP> <10057@smoke.BRL.MIL> <628@gonzo.UUCP> Sender: usenet@ucbvax.BERKELEY.EDU Reply-To: jas@ernie.Berkeley.EDU (Jim Shankland) Organization: University of California, Berkeley Lines: 49 In article <628@gonzo.UUCP> daveb@gonzo.UUCP (Dave Brower) writes: [A long diatribe against use of the comma operator in all contexts except macro bodies, and, sometimes, "for" loop initialization and continuation.] Granted, everyone should write code that is easily understandable by others. Granted, also, that the way to do that depends on idioms in common use in a particular language: constructs that are common usage in, e.g., LISP, may be obscure in C. Granted, finally, that it is quite possible to write obscure C code by using the comma operator (and in countless other ways). I still suggest that a C programmer who understands: (A) if (x->in_use) { x++; y++; } but who is mystified by: (B) if (x->in_use) x++, y++; had best be investigating alternate career paths. The goal daveb@gonzo is pursuing is an admirable one: how can we get programmers, especially masses of programmers, to write code that is correct, understandable, and modifiable by others, in reasonable time? It is certainly one of the most important questions in programming, and answers have been slow in coming. I understand and sympathize with the temptation to tilt at windmills; but it won't kill the dragons. The world is full of bad programmers. A magic potion that would turn them all into good programmers would be a useful thing, indeed. Brings to mind the (surely apocryphal) story about the ne'er-do-wells who finagled an NSF grant to research ways to turn cow shit into butter. Having partied away the entire grant, they applied for supplemental funds, with the argument: "We've gotten it to spread like butter, now we need more money to work on the taste." Exorcising the comma operator from bad code may make it spread better. The taste, alas, remains unchanged. Jim Shankland jas@ernie.berkeley.edu "Blame it on the lies that killed us, blame it on the truth that ran us down"