httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ben Laurie <...@gonzo.ben.algroup.co.uk>
Subject Re: Oh no! Not that list again...
Date Mon, 15 Jul 1996 22:45:50 GMT
Tony Sanders wrote:
> 
> Ben Laurie writes:
> > Yes, here it is again. Note that a new section, 15, has been added. Also note
> > that MANY people have not bothered to vote on the later sections. Get yer act
> > together, guys!
> Dunno if my vote counts or not but here are my preferences, based
> on BSD KNF (Kernel Normal Form).
> 
> I'll even toss in a few "rationals" where my vote differs from the
> current consensus.

I'm afraid that in my view your vote doesn't count, and I think you mean
"rationales". Of course, you do have some say, so read on...

> * see comments
> 
> > 1. Function declarations
> > a) int
> >    main(...)
> 
> Rational:  grep ^main *.c
> 
> This is *highly* standard C style.  I am very surprised
> that the group consensus is currently for `b' (yuck).

Feel free to be surprised.

> 
> > 3. Braces
> ...
> > a2)	if(x) {
> > 	    code;
> > 	}
> > 	else {
> > 	    code;
> > 	}
> 
> Rational: easy to add code segments without screwing up and doesn't
> 	  waste too much white-space.
> 	  
> > 5. Comment indentation
> > 
> > a)	code;
> > 	/* comment */
> > 	code;
> > b)	code;
> >     /* comment */
> > 	code;
> 
> I actually like:
> 
> 	/*
> 	 * Major section meta-information
> 	 */
> 	code;
> 	code;		/* micro-comment */
> 
> 
> The large block comments should document the logic of each section of
> code that you can search for `/*$' and follow the logic without having
> to read the code.

As I said in an earlier post, I'm not prepared to include commenting style as
an issue unless someone can come up with some clear rules. All I'm asking here
is whether comments in any format should be outdented.

> 
> 
> > 6. Switches
> > Note: Illustrated using 3a.
> > 
> > a)	switch(x) {
> > 	case a:
> > 	    code;
> > 	case b:
> > 	    code;
> > 	}
> > b)	switch(x) {
> > 	    case a:
> > 		code;
> > 	    case b:
> > 		code;
> > 	}
> Neither, I like to use half-dents for case and default:
> 	switch(x) {
> 	  case a:
> 	  case b:
> 	    code;
> 	}

If there's any support at all for this style I'll include it as an option.

> 
> > 14. Capitalisation of enums
> > 
> > a) enum x { ONE, TWO };
> > b) enum x { one, two };
> > c) No rule.
> d) initial cap:  enum x { One, Two };

See above.

> 
> > 15. Spaces after keywords
> > 
> > a) if(x)
> > b) if (x)
> 
> Rational:  Spaces after keywords, no spaces after functions.
>            grep 'mysub(' *.c
> 
> e.g.:
> 	if (x)
> 	while (x)
> 	mysub(x)

Cheers,

Ben.

-- 
Ben Laurie                  Phone: +44 (181) 994 6435
Freelance Consultant and    Fax:   +44 (181) 994 6472
Technical Director          Email: ben@algroup.co.uk
A.L. Digital Ltd,           URL: http://www.algroup.co.uk
London, England.

Mime
View raw message