Path: utzoo!attcan!uunet!peregrine!elroy!ames!mailrus!uflorida!novavax!twwells!bill From: bill@twwells.uucp (T. William Wells) Newsgroups: comp.lang.c Subject: Re: Proposal for a scientific look at C style choices Summary: some reasons why I code with my style Message-ID: <272@twwells.uucp> Date: 24 Dec 88 00:16:42 GMT References: Reply-To: bill@twwells.UUCP (T. William Wells) Organization: None, Ft. Lauderdale Lines: 41 Expires: Sender: Followup-To: Distribution: Keywords: In article eric@snark.UUCP (Eric S. Raymond) writes: : Let's start by mapping a really major node. Maybe the most basic question : in C layout is: : : Question A: Which do you value more; conservation of vertical space, or a : global rule that start braces go at the same visual indent level as their end : braces? : : If your answer is "value conservation more", then you are likely to use : Kernighan & Ritchie style: : : if (cond) { : /* stuff */ : } I believe that there is an alternate rationale for the above style: that braces exist only to make the compiler happy and should therefore be as unobtrusive as possible. This is why I use the above; I recall dmr saying that that is his reason as well. However I do value conservation of vertical space. Which is why, for the purposes of deciding whether a blank line should be inserted, I consider a line containing a brace to be equivalent to a blank line. : Question B: in control structures, do you consider the braces to be more : firmly glued to a) the "guard" part, or b) the enclosed statement(s). : : If your answer to "B" is a), you're likely to plump for the Pascal-oid layout. : If it's b), you probably like some Whitesmiths variant. I *think*. I'm inviting : comment on all this. I consider the braces as a separate element: sometimes necessary for the compiler (but I always use the braces), but contributing little or nothing to the understandability of the program. The indentation of the program is what tells you the control relationships; the braces are redundant information, at best they can augment what the indentation is alreaddy telling you. --- Bill {uunet|novavax}!proxftl!twwells!bill