Coding standards

Medland, Bill Bill.Medland at accpac.com
Wed Nov 27 11:45:18 CST 2002


		> -----Original Message-----
> From: wine-devel-admin at winehq.com 
> [mailto:wine-devel-admin at winehq.com]On
> Behalf Of David Laight
> Sent: Wednesday, November 27, 2002 1:34 AM
> Cc: wine-devel at winehq.com
> Subject: Re: Coding standards
> 
> 
> > >Probably vi with autoindent, tabstop=8 and shiftwidth=4 
> (my preferred indent).
> > 
> > Of course everyone has his own taste and there's nothing 
> wrong with 8. We
> > just found that with 8 spaces there's very much indentation 
> if you have quite
> > some nested ifs/whiles/fors/whatevers. While still trying 
> to stay under 80 
> > chars per line (for a nice printing) you don't have much space left
> > to put code on :)
> 
> Indeed - printing in one reason you should not set the tab size to
> anything other than 8.
> 
> With vi and sw=4,ts=8,ai you indent with ^T and outdent with ^D.
> vi adds the correct number of tabs and spaces to end up in the
> right position.

which is what I hate.  This is the worst of both worlds.  Either use Tabs
throughout so that a tab equals an indent and so people can set the tab size
to whatever they like or else don't use tabs at all and use explicit spaces.
(The usual argument for using tabs relates to the fact that they line up
with proportionally spaced fonts but I don't think that worries us does it;
I almost always use a fixed font for code display).
I would argue in favour of using tabs for indent if it were not for the fact
that we already have an enormous amount of code that doesn't and I doubt if
we would refuse code that didn't.

> 
> 8 char indents (as used by netbsd) to tend to leave you trying to
> pretify code in about 16 colums sometimes.
> Made more likely if your style involves 2 indents for a switch
> statement, eg:
> 	switch (...) {
> 		case ...:
> 			break;
> 
> 	David
> 
> -- 
> David Laight: david at l8s.co.uk
> 
> 
Bill Medland



More information about the wine-devel mailing list