From owner-freebsd-chat Wed May 29 02:13:21 1996 Return-Path: owner-chat Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id CAA20896 for chat-outgoing; Wed, 29 May 1996 02:13:21 -0700 (PDT) Received: from diablo.ppp.de (diablo.ppp.de [193.141.101.34]) by freefall.freebsd.org (8.7.5/8.7.3) with SMTP id CAA20887 for ; Wed, 29 May 1996 02:13:04 -0700 (PDT) Received: from allegro.lemis.de by diablo.ppp.de with smtp (Smail3.1.28.1 #1) id m0uOfw8-000QZoC; Wed, 29 May 96 09:44 MET DST From: grog@lemis.de (Greg Lehey) Organisation: LEMIS, Schellnhausen 2, 36325 Feldatal, Germany Phone: +49-6637-919123 Fax: +49-6637-919122 Received: (grog@localhost) by allegro.lemis.de (8.6.9/8.6.9) id JAA19555; Wed, 29 May 1996 09:26:40 +0200 Message-Id: <199605290726.JAA19555@allegro.lemis.de> Subject: Re: Indentation styles To: rnordier@iafrica.com (Robert Nordier) Date: Wed, 29 May 1996 09:26:40 +0200 (MET DST) Cc: chat@FreeBSD.ORG (FreeBSD Chat) In-Reply-To: <199605281940.VAA00188@eac.iafrica.com> from "Robert Nordier" at May 28, 96 09:39:59 pm X-Mailer: ELM [version 2.4 PL23] MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Sender: owner-chat@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk Robert Nordier writes: > > Terry Lambert wrote: >>> I think Greg's concern in valid, but this is one of Nature's >>> Insoluble Problems. Let's have some sanity, please! >> >> At one time I suggested running a "beautifier" on code as part of the >> CVS commit process. I still like the idea. >> >> I also like the idea of running a local style template on checkout >> from a CVS tree. 8-). > > A local style template on checkout isn't a bad idea. If only 'indent' > were just a little smarter. But (just when things seem to be going > well) it comes up with: > > static char *f_args[F_ARGS] = { > "160", "180", "320", "360", /* K_ARGS */ > "720", "1200", "1440", "2880", > "1.2", "1.44", "2.88" /* M_ARGS */ >} ; > > static struct BPB stdbpb[BPBCNT] = { > {512, 1, 1, 2, 64, 320, 0xfe, 1, 8, 1, 0, 0}, /* 160K */ > {512, 1, 1, 2, 64, 360, 0xfc, 2, 9, 1, 0, 0}, /* 180K */ > {512, 2, 1, 2, 112, 640, 0xff, 1, 8, 2, 0, 0}, /* 320K */ > {512, 2, 1, 2, 112, 720, 0xfd, 2, 9, 2, 0, 0}, /* 360K */ > {512, 2, 1, 2, 112, 1440, 0xf9, 3, 9, 2, 0, 0}, /* 720K */ > {512, 1, 1, 2, 224, 2400, 0xf9, 7, 15, 2, 0, 0}, /* 1.2M */ > {512, 1, 1, 2, 224, 2880, 0xf0, 9, 18, 2, 0, 0}, /* 1.44M */ > {512, 2, 1, 2, 240, 5760, 0xf0, 9, 36, 2, 0, 0} /* 2.88M */ >} ; You don't say how you want it to look. This looks OK to me, except for the hanging braces (personal taste). Just for giggles, I ran this fragment through indent and got: static char *f_args [F_ARGS] = { "160", "180", "320", "360", /* K_ARGS */ "720", "1200", "1440", "2880", "1.2", "1.44", "2.88" /* M_ARGS */ }; static struct BPB stdbpb [BPBCNT] = { {512, 1, 1, 2, 64, 320, 0xfe, 1, 8, 1, 0, 0}, /* 160K */ {512, 1, 1, 2, 64, 360, 0xfc, 2, 9, 1, 0, 0}, /* 180K */ {512, 2, 1, 2, 112, 640, 0xff, 1, 8, 2, 0, 0}, /* 320K */ {512, 2, 1, 2, 112, 720, 0xfd, 2, 9, 2, 0, 0}, /* 360K */ {512, 2, 1, 2, 112, 1440, 0xf9, 3, 9, 2, 0, 0}, /* 720K */ {512, 1, 1, 2, 224, 2400, 0xf9, 7, 15, 2, 0, 0}, /* 1.2M */ {512, 1, 1, 2, 224, 2880, 0xf0, 9, 18, 2, 0, 0}, /* 1.44M */ {512, 2, 1, 2, 240, 5760, 0xf0, 9, 36, 2, 0, 0} /* 2.88M */ }; This is pretty much what I want to see. > I think my main point is that a "What is not forbidden should be made > compulsory" attitude is likely to make a few (maybe eccentric) souls > unhappy. And maybe the issue is just too contentious for common-sense > to prevail. I think this is dodging the point. The point is that one limitation on what you can do in working on somebody else's code is the degree to which you can understand it. If you can do something to improve that situation, this will help you achieve more objectives. One way to work towards this goal is to have style guides. Of course, as Terry point out, a lot of them are based on convention and the tools you use. The FreeBSD style doesn't work well with my tools, which is why I sent out the original message. Greg