Path: utzoo!attcan!uunet!lll-winken!ames!pacbell!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: Code layout style specifics Message-ID: <138@mole-end.UUCP> Date: 7 Jan 89 12:46:30 GMT References: <132@mole-end.UUCP> <1045@ns.UUCP> <1057@ns.UUCP> Organization: mole-end--private system. admin: mole-end!newtnews Lines: 49 > :Hmm. Do you mean that you have never written > : > :#if ... > :# if ... > :. . . > :# else > > Well, I understand dpANS allows the "#" to be the first non-blank character > on the line, rather than precisely the first, so this could be done in the > normal obvious way in a compliant compiler. I believe that that's what I've > done when I nest conditionals (not too often, obviously). dpANS is not yet universal. Besides, I really DO prefer to see the # in the first column so that I can scan for the conditional compilation grunge right away--and so that I don't miss some effect of it later on while scanning the code for something else. > > if (((a->op == XNES_step) && (a->size <= XNES_bufsize)) || > ((a->op == XNES_fix) && ((a->size + a->leftover) <= XNES_bufsize))) { > /* code */ > } > For a more complex expression I would tend to indent blocks as indicated > by the parenthasization of the expression. Indenting isn't a bad idea. But is it a good idea to use so many redundant parens? When I put parens in, I *mean* them to be there; I *mean* that the normal, usually correct (ok, except for bitops .vs. relops and equops) precedence is violated; in their absence, default thinking and default perception will do just fine. Do you *really* want to bury the conjuntive/disjuntive operators at the end or in the middle of the line? In C they short-circuit, so they have some flow control responsibility, but in any language their effect is more a matter of control structure in most instances than it is a matter of simple value computation. (My opinion, of course.) Given that, it makes sense to keep them up-front and visible. > :(Ok, even nroff wouldn't have put the ``)'' at the beginning of a line. I > :have seen it done by programmers, however.) > > Ucky poo. Blecch. My feelings exactly--the first few times. After that, my disgust reaches the heavens and my exclamations reach the floor above. -- (This man's opinions are his own.) From mole-end Mark Terribile