Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site brl-tgr.ARPA Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!genrad!panda!talcott!harvard!seismo!brl-tgr!tgr!jon@cit-vax From: jon@cit-vax (Jonathan P. Leech) Newsgroups: net.lang.c Subject: Re: C Indentation Survey Results (long...) Message-ID: <10493@brl-tgr.ARPA> Date: Tue, 7-May-85 20:47:07 EDT Article-I.D.: brl-tgr.10493 Posted: Tue May 7 20:47:07 1985 Date-Received: Thu, 9-May-85 02:48:07 EDT Sender: news@brl-tgr.ARPA Lines: 37 > Now, isn't this rendition of the example given earlier **MUCH** easier to > read, parse, and understand?... Not really. What was originally posted was NOT 'K&R orthodox bracing style', anyway. It wasn't written very well either. The following version seems much better to me: switch (key) { case BACK: fprintf(stoout,"BACK\n"); foo = &(device->s.stroke); if (foo->current_editpos > 1) { int cnt = --(foo->current_editpos); foo->editptr = &(foo->header); for (i = 1; foo->editptr->next->next, i < cnt; i++) foo->editptr = foo->editptr->next; } else { #ifdef DEBUG It's smaller, faster, and I find it far easier to read. From a religous standpoint, I find empty block bodies disgusting. I think the indenting style is not anywhere near as important as applying at little thought to the code in this case, anyway. > And (as long as we are sharpening axes here) if you were programming in > PASCAL you could put the sucker in a WITH DEVICE clause and get rid of all > those "device->" references. AND, it would be more efficient since the > reference would only be evaluated once, at the WITH clause (clearly compiler > optimization in C compilers would have a bearing on this). Big deal. That's exactly what's going on above, with the additional (to me) advantage that the structure pointer being used is explicit. I sometimes confuse variables with record members in a PASCAL WITH block. -- Jon Leech jon@cit-vax.arpa __@/