Date: Sat, 16 Dec 2000 16:55:40 -0700 (MST) From: Nate Williams <nate@yogotech.com> To: Greg Lehey <grog@lemis.com> Cc: Nate Williams <nate@yogotech.com>, Warner Losh <imp@village.org>, chat@FreeBSD.org Subject: Re: Coding style (was Re: cvs commit: [...] pci.c [...]) Message-ID: <14908.252.364058.869839@nomad.yogotech.com> 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> <marcel@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>
next in thread | previous in thread | raw e-mail | index | archive | help
> > 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?14908.252.364058.869839>
