Path: utzoo!utgpu!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!ames!killer!vector!rpp386!jfh
From: jfh@rpp386.Dallas.TX.US (The Beach Bum)
Newsgroups: comp.unix.wizards
Subject: Re: Latest indent request
Message-ID: <9125@rpp386.Dallas.TX.US>
Date: 4 Dec 88 21:19:24 GMT
References: <17680@adm.BRL.MIL> <1748@solo3.cs.vu.nl> <9063@smoke.BRL.MIL>
Reply-To: jfh@rpp386.Dallas.TX.US (The Beach Bum)
Organization: Big "D" Home for Wayward Hackers
Lines: 74

In article <9063@smoke.BRL.MIL> gwyn@brl.arpa (Doug Gwyn (VLD/VMB) ) writes:
>In article <1748@solo3.cs.vu.nl> maart@cs.vu.nl (Maarten Litmaath) writes:
>>gaspar@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@rpp386.Dallas.TX.US       |tired of looking at these damn =(___)=
UucpNet : !killer!rpp386!jfh  +things in everybody's .sig?-------U---