From owner-freebsd-chat Sat Dec 16 15:55:58 2000 From owner-freebsd-chat@FreeBSD.ORG Sat Dec 16 15:55:55 2000 Return-Path: Delivered-To: freebsd-chat@freebsd.org Received: from ns.yogotech.com (ns.yogotech.com [206.127.123.66]) by hub.freebsd.org (Postfix) with ESMTP id 4166E37B400 for ; Sat, 16 Dec 2000 15:55:52 -0800 (PST) Received: from nomad.yogotech.com (nomad.yogotech.com [206.127.123.131]) by ns.yogotech.com (8.9.3/8.9.3) with ESMTP id QAA28319; Sat, 16 Dec 2000 16:55:46 -0700 (MST) (envelope-from nate@nomad.yogotech.com) Received: (from nate@localhost) by nomad.yogotech.com (8.8.8/8.8.8) id QAA06277; Sat, 16 Dec 2000 16:55:41 -0700 (MST) (envelope-from nate) From: Nate Williams MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <14908.252.364058.869839@nomad.yogotech.com> Date: Sat, 16 Dec 2000 16:55:40 -0700 (MST) To: Greg Lehey Cc: Nate Williams , Warner Losh , chat@FreeBSD.org Subject: Re: Coding style (was Re: cvs commit: [...] pci.c [...]) In-Reply-To: <20001217101426.N98509@wantadilla.lemis.com> References: <15273.976919515@winston.osd.bsdi.com> <200012160006.TAA92008@khavrinen.lcs.mit.edu> <3A3AAB12.EB84759E@cup.hp.com> <3A3A96E0.DDDDFA55@cup.hp.com> <14906.41033.930780.802740@nomad.yogotech.com> <20001216114710.H91832@wantadilla.lemis.com> <200012160553.WAA74580@harmony.village.org> <20001216184937.G97408@wantadilla.lemis.com> <14907.45114.931200.484569@nomad.yogotech.com> <20001217101426.N98509@wantadilla.lemis.com> X-Mailer: VM 6.75 under 21.1 (patch 12) "Channel Islands" XEmacs Lucid Reply-To: nate@yogotech.com (Nate Williams) Sender: owner-freebsd-chat@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org > > It's overflows my terminal window so badly that it's useless, and I > > couldn't even print it on a printer so I can read it (yet another good > > reason to stick to 80-char line-widths). > > Or to 100 character line widths. Or 120 character line widths. > Depends on your window. Years ago I decided to limit my lines to 110 > characters so that I could print it on a printer, so that comment is > valid, modulo line length. My printer limits me to 80-chars/line. That's typical for every common printer I've used unless you do some special processing of them. (Big workgroup line-printers allow longer lines, but I don't know many people who own one of those. :) > >> s = checksdstate (sd, rq, *diskaddr, diskend); /* do we need to change state? */ > > > > Useless comment. > > Superfluous. Not useless. Without it, and without reading > checksdstate, you wouldn't know whether checksdstate just confirmed > the status, or whether it changed it. I would assume it just checked it, else it would have a different name. :) > >> if (s && (m.badsdno >= 0)) /* second bad disk, */ > > > > This line I would write like this. The 'question' mark implies that > > it's a question, and the comma has no business being there. This also > > makes it easier to print and read on every terminal used by man. > > > > /* second bad disk? */ > > Agreed, not every comment is 100% perfect. But you've put the comment > where it interrupts the flow. In my book, that should be reserved for > larger comment blocks. Interrupt the flow? If it's a useful comment, then it's a useful comment, and it's not interrupting anything. The comment (if it's needed) is just as useful as the code that implements the functino. > >> for (sdno = 0; sdno < m.sdcount; sdno++) > >> { > > > > Yuck, but that's a religious thing.. > > Agreed. I'm not advocating that the project should change to that > style. > > >> struct sd *sd = &SD [plex->sdnos [sdno]]; > >> if (sd->state >= sd_reborn) /* sort of up, */ > > > > Re-written. > > Sorry, I don't understand this comment. I re-wrote the lines to those below. > > > /* sort of up, */ > >> set_sd_state (sd->sdno, sd_stale, setstate_force); /* make it stale */ > > > > Useless comment. > > No, superfluous. Whatever. > > Much better! Too much white-space is bad, but so is not enough > > white-space. With snuggly braces you lose alot of white-space, so you > > can add in white-space back at good places. > > Agreed, that makes it more legible. I still find comments on the > right better. They require me to 'interrupt my flow' of understand to read them, which means I have to spend time going back to the 'code' to get back to place. In other words, right-handed comments interrupt my flow of understanding. :) Nate To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-chat" in the body of the message