Latest indent request

The Beach Bum jfh at rpp386.Dallas.TX.US
Mon Dec 5 07:19:24 AEST 1988


In article <9063 at smoke.BRL.MIL> gwyn at brl.arpa (Doug Gwyn (VLD/VMB) <gwyn>) writes:
>In article <1748 at solo3.cs.vu.nl> maart at cs.vu.nl (Maarten Litmaath) writes:
>>gaspar at almsa-1.arpa (Al Gaspar) writes:
>>\	if (test)
>>\		{
>>\		whatever;
>>\		}
>>What a DISGUSTING format!
>
>Most programmers I know that have tried vertical alignment of braces
>for a while have come to prefer that to the style in K&R.  With "sam"
>the K&R style becomes acceptable because it is easy to find the
>matching brace.

I have one MAJOR gripe with the above { } scheme.  Consider:

main ()
{
	if (expr)
		{
		while (cond)
			{
			};
		}
/*	possible missing } on this line??? */
}

This is UGLY UGLY UGLY.  It is also counter-intuitive.  You go from
one nesting level to TWO???  Which is why I generally include the following
rule to my list of bracketing rules -

	ALWAYS use brackets on an outer level if they are used on an
	inner level.

As it helps show the structure which may not be visible above the top of
the screen.  This particular formatting scheme lies about the structure.
The alternative is to place all statements inside the function body starting
in column 0.  Which is, IMHO, totally gross.

For example -

	if (test)
		while (cond) {
			state1;
			state2;
		}

is worse than

	if (test) {
		while (cond) {
			state1;
			state2;
		}
	}

>In any case, when modifying existing code we use the
>same style as in the existing code, whatever it may be (unless the
>code is totally misformatted, in which case we beautify it first).

Here I agree 100%.  One of our vendors uses the above mentioned
horrible bracketing style and as little white space as possible.
The first thing I do now is beautify the code.  I don't even waste
time deciding if it is ugly or not.

>Henry is a nice enough guy, but he's not God (in fact the first
>attribute probably precules the second).

Henry is too god.  You're just jealous ;-)
-- 
John F. Haugh II                        +-Cat of the Week:--------------_   /|-
VoiceNet: (214) 250-3311   Data: -6272  |Aren't you absolutely sick and \'o.O'
InterNet: jfh at rpp386.Dallas.TX.US       |tired of looking at these damn =(___)=
UucpNet : <backbone>!killer!rpp386!jfh  +things in everybody's .sig?-------U---



More information about the Comp.unix.wizards mailing list