comma operator: keep away?

Henry Spencer henry at utzoo.uucp
Tue Apr 25 03:22:19 AEST 1989


In article <28831 at ucbvax.BERKELEY.EDU> jas at ernie.Berkeley.EDU (Jim Shankland) writes:
>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.

This is very true.  On the other hand, a C programmer who writes the latter
should also be investigating alternate career paths, because he's clearly
an amateur in a business that needs professionals.  Anyone who says "any
competent programmer ought to be able to understand that!" rather than
"I should make my code as clear as possible!" is an amateur, and one with
an ego problem at that.  Readability is very much a matter of what you're
used to.  Like it or lump it, most C programmers are used to (A) and not (B).
A programmer with a professional attitude will therefore use (A) to make his
code as readable as possible, unless there is some special reason to do
otherwise.

To quote #8 from the Ten Commandments for C Programmers:

	Thou shalt make thy program's purpose and structure
	clear to thy fellow man by using [a familiar style],
	even if thou likest it not, for thy creativity is better
	used in solving problems than in creating beautiful new
	impediments to understanding.
-- 
Mars in 1980s:  USSR, 2 tries, |     Henry Spencer at U of Toronto Zoology
2 failures; USA, 0 tries.      | uunet!attcan!utzoo!henry henry at zoo.toronto.edu



More information about the Comp.unix.questions mailing list