[net.lang.c] Our friends, }'

smh@mit-eddie.UUCP (Steven M. Haflich) (07/25/83)

I have always formated my C code as follows:
		for (...) {
			...
		}
This is an abbreviation of the more rational:
		for (...)
		{
			...
		}
Since I rarely make listings and usually only see my code through
a standard (but small) 24-line CRT window, the saved lines make more
code visible at one time.  Even when dealing with listings, I find
the more fits on a page, the easier to read largish programs.  For
the same reasons, I have no compunction about formatting short, clear,
"idiomatic" code blocks this way:
		if (argc>1) { pname = *argv++; argc--; }

				Steve Haflich

berry@fortune.UUCP (07/25/83)

#R:ucbesvax:4800019:fortune:16200006:000:414
fortune!berry    Jul 25 11:50:00 1983

	I personally have found the following style of {} quite easy to read
and type.  I don't know actually where I picked up each statement, but they
did come from a variety of places and I believe they do form a fairly
complete and consistent set:

	if() {
		...
		}

	struct	gorp	{
		...
		}
	= {
		...
		} ...;

	switch() {
	case	:
		...
		}


	David W. Berry
	amd70!fortune!berry
	cbosgd!...
	harpo!...
	hpda!...

zz1sm@sdccsu3.UUCP (Shane) (07/27/83)

I also use 
	for (;;) {
	    ...
	}
because it gets more code on a page, and 
	for (;;) { short; stuff; }
for the same reason.

Shane

!ucbvax!sdcsvax!sdccsu3!zz1sm

cfv@packet.UUCP (07/31/83)

I started out writing almost all of my code using:

	for (;';)
	{
		...
	}

for nesting, but in the last 6 months I found that I had unconsiously
switched to the K&R form of:

	for (;;) {
		...
	}

Why I did is still a bit of a mystery to me. I think that I did it because
as I became a better C programmer (writer and reader) I didn't need that
explicitly visual form of nesting as badly, and it was nice to compact those
lines together (white space is wonderful, but appropriate white space is
best). Now that I use K&R's nesting, I find that it IS a lot more compact,
but I haven't lost any of the readability of the code that I used the first
form for.
-- 
>From the dungeons of the Warlock:
					      Chuck Von Rospach
					      ucbvax!amd70!packet!cfv
					      (chuqui@mit-mc)  <- obsolete!