Path: utzoo!utgpu!watmath!clyde!att!westmark!mole-end!mat From: mat@mole-end.UUCP (Mark A Terribile) Newsgroups: comp.lang.c Subject: Re: Proposal for a scientific look at C style choices Summary: Another edge on the style graph ... and why Message-ID: <132@mole-end.UUCP> Date: 27 Dec 88 02:49:29 GMT References: Organization: mole-end--private system. admin: mole-end!newtnews Lines: 54 > C code layout is a classic example of rule-governed behavior in which the > rules are inexplicit and often less than half-conscious, but evidently very > strong. > [I'd like to] work out ... a decision tree or graph that has coders' value > choices about various aesthetic issues as arcs and various described coding > styles or coding style classes as nodes -- a ... functional taxonomy .... > Now, I *think* that the "comb" versus "block" choice hangs on a question > that goes something like this: > > Question S: are you willing to make an exception to the global rule that the > contents of a control block is indented one level deeper than the "sentinel" > part in order to make switches look more like jump tables, or to reduce their > cost in visual nesting depth? I will offer another decision that must be made: is the ``sentinel'' part a monolith, or does it have multiple levels as well? I indent the case labels by two spaces on the belief that they are easier to see that way (I use 8-space indents) and on the belief that the control (sentinel) is not a monolith. Likewise, I generally write if( a->op == XNES_step && a->size <= XNES_bufsize || a->op == XNES_fix && a->size + a->leftover <= XNES_bufsize ) { . . . > If I'm right, this is one node in the ur-graph of C styles I'm after. The > interesting question: are there other, *fundamentally different* criteria on > which this choice can be made? If so, what are they? Visual presentation, for one. I like to be able to look at a piece of code three feet away and know where the different chunks of code begin and end, and upon which ``splinters'' the various chunks depend. (I'm a charter member of The Committe to Keep Whitespace White :^> ) Oh, and I prefer to see my text printed in portrait mode using a fixed-width ``typewriter'' font by a high-res (laser or electrostatic) printer. > 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). Neither. They are an adapter between the ``guard'' which controls single statements and the group of statements which often need to be controlled together. -- (This man's opinions are his own.) From mole-end Mark Terribile