A brace vs. indentation hypothesis

David Goodenough dg at lakart.UUCP
Thu Jan 19 02:22:35 AEST 1989


bph at buengc.BU.EDU (Blair P. Houghton) sez:
> Try this:
> 
>     if (condition && much longer
> 	conditional expression sequence
> 	than is really excusable, with strange arrangement ef-
> 	fects)
> 	action();
>     {
> 	volatile gas;
> 
> 	fprintf(stdmess,"Don't light that match!");
> 	explode(gas);
>     }

     if (condition && much longer conditional expression sequence
		     than is really excusable, with strange arrangement effects)
 	action();
     {
 	volatile gas;
 
 	fprintf(stdmess,"Don't light that match!");
 	explode(gas);
     }

Rather obvious now, isn't it. I ALWAYS place continuation lines four
indent levels (i.e. 16 characters) to the right, as opposed to structure
indent (one level - 4 characters)

And before you complain about huge tests in conditionals, it has usually
been my experience that if there _IS_ a huge test in a conditional
it can be removed by a rewrite, and said rewrite generally winds up
improving something else into the bargain.

But then I think funny for a programmer. :-)
-- 
	dg at lakart.UUCP - David Goodenough		+---+
						IHS	| +-+-+
	....... !harvard!xait!lakart!dg			+-+-+ |
AKA:	dg%lakart.uucp at xait.xerox.com		  	  +---+



More information about the Comp.lang.c mailing list