A question of style
Chip Salzenberg
chip at ateng.com
Fri Dec 8 04:03:47 AEST 1989
According to jeffa at hpmwtd.HP.COM (Jeff Aguilera):
>I understand (and accept) that most programmers are compelled to use the K&R
>form, following their masters' dogma blindly, criticizing all others.
Mr. Aguilera understands nothing. "Criticizing all others," indeed! A
certain phrase mentioning pots and kettles comes to mind.
A construct's being quickly identifiable by most C programmers makes that
thing immediately preferable to an equivalent but less common construct.
And if there's one book a C programmer has almost certainly read, it's K&R.
The general rule I adhere to most strictly is: "Repetition is evil."
For example, "i = i + 1" is inherently harder to read than "i++", since the
former requires the identification of two variable names (albeit identical
ones) whereas the latter only contains one name. The expression
"c=getchar(), c!=EOF" is harder to read than "(c = getchar()) != EOF" for
the same reason.
--
You may redistribute this article only to those who may freely do likewise.
Chip Salzenberg at A T Engineering; <chip at ateng.com> or <uunet!ateng!chip>
"The Usenet, in a very real sense, does not exist."
More information about the Comp.lang.c
mailing list