Date: Sun, 2 Jun 1996 16:10:53 +0200 (MET DST) From: J Wunsch <j@uriah.heep.sax.de> To: chat@FreeBSD.ORG Subject: Re: Indentation styles Message-ID: <199606021410.QAA01867@uriah.heep.sax.de> In-Reply-To: <199606020842.KAA15765@allegro.lemis.de> from Greg Lehey at "Jun 2, 96 10:42:09 am"
next in thread | previous in thread | raw e-mail | index | archive | help
As Greg Lehey wrote: > > The typografical rules say ~ 60 chars per line, everything else has to > > be made two-column (a bit impractical for programs :). > > I've been thinking about this for a while, and I both agree and > disagree. Yes, more than 60 chars per line become difficult to read, > but I *do* use dual columns in my programs. There are these things > called comments which I align in a column at the right (starting at > column 50 by default). I don't like it when too many code lines run > into the comment columns. ``comment columns'' are not really sanctioned by KNF. Look at style(9) and into all the 4.4BSD-derived stuff, comments are usually aligned at the indent level of the code. You should not comment each and any line, it doesn't make the code better readable nor better understandable. Instead, usually a larger block should be commented explaining its purpose. This way, you won't have a need for two-column styled C programs. /* * Determine i/o configuration for a machine. */ static void configure(dummy) void *dummy; { configure_start(); /* Allow all routines to decide for themselves if they want intrs */ enable_intr(); INTREN(IRQ_SLAVE); #if NCRD > 0 /* Before isa_configure to avoid ISA drivers finding our cards */ pccard_configure(); #endif ... #ifdef MFS_ROOT if (!mountroot) { mountroot = vfs_mountroot; /* XXX goes away*/ mountrootvfsops = &mfs_vfsops; /* * Ignore the -a flag if this kernel isn't compiled * with a generic root/swap configuration: if we skip * setroot() and we aren't a generic kernel, chaos * will ensue because setconf() will be a no-op. * (rootdev is always initialized to NODEV in a * generic configuration, so we test for that.) */ if ((boothowto & RB_ASKNAME) == 0 || rootdev != NODEV) setroot(); } #endif ... The only comment that fits your description is the short XXX one. You'll notice that the above fits pretty into an 80-column world, and it's far from being unreadable. (It still violates the style(9) requirement of making comments full sentences wherever possible and useful.) -- cheers, J"org joerg_wunsch@uriah.heep.sax.de -- http://www.sax.de/~joerg/ -- NIC: JW11-RIPE Never trust an operating system you don't have sources for. ;-)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199606021410.QAA01867>