Coding standards

David Laight david at l8s.co.uk
Tue Nov 26 11:18:21 CST 2002


> I found a couple that used ~4space indent, and used tabs too (they 
> seemed to expect 1tab = 8, as the code looked neat in a standard text 
> editor).

Probably vi with autoindent, tabstop=8 and shiftwidth=4 (my preferred indent).

More fun can be had arguing over whether to do:

	if (...) {
		...
	} else {
		...
	}
or:
	if (...)
	{
		...
	}
	else
	{
		...
	}
or:
	if (...)
		{
		...
		}
	else
		{
		...
		}

If you have a paper listing you definitely need '} else {' on
a single line.  Otherwise you lose track of the control flow
when reading it.
(Never mind that you get many more lines on a page/screen.)

Of course the opening '{' for a function MUST be in column 1.

A coding standard really ought to discuss namespace usage and
pollution.  Any reasonable layout is usually ok.
(OTOH I much prefer that tab stops be at 8 character intervals.)

	David

-- 
David Laight: david at l8s.co.uk



More information about the wine-devel mailing list