Coding Standards (was Re: Indentation...)

Russ Nelson nelson at sun.soe.clarkson.edu
Wed Dec 14 04:54:33 AEST 1988


In article <2802 at hound.UUCP> rkl1 at hound.UUCP (K.LAUX) writes:

	   So, if you don't have a Coding Standards document to spell
   things out, create one and get it approved.  I never said it was
   *required* for everyone to like/agree with it - just to follow it.

I am the poster who started the whole ball of was [rolling | melting] again.

I got quite a few responses both by mail and by follow-ups to my
query, in which I asked if there exist any standards for indentation.
Several people pointed out that K&R use a consistent indentation in
their books, and also that cb and indent will impose a consistent
indentation.  Curiously, I didn't hear that people actually *use* K&R
or cb formatting.

The general advice that I got was to, when modifying existing code,
stick to the existing style, and when creating new code, use a
consistent style.

I also realize that the question that I meant to ask was larger than
just indentation -- it also covers comment style, whitespace, brace
positioning, etc.  So, to come to my rescue (?) is an article by Ken
Arnold his C Advisor column in Unix Review Vol. 6 No. 12 on "Stylistic
Stuff".

I was hoping to find out that there are only a few styles in use, so
that a user could become familiar with them all and use whichever was
appropriate (as above).
--
--russ (nelson at clutx [.bitnet | .clarkson.edu])
To surrender is to remain in the hands of barbarians for the rest of my life.
To fight is to leave my bones exposed in the desert waste.



More information about the Comp.unix.wizards mailing list