Re: Structure vs purism ?

Steve Dodd (dirk@loth.demon.co.uk)
Fri, 22 Jan 1999 16:40:41 +0000


Hi,

On Thu, Jan 21, 1999 at 04:53:48PM -0500, Chuck Lever wrote:

> usually when one writes code using uncommon practices, a comment is
> warranted to explain the obfuscation, but we could get very clever and use
> C macros :)

There's a school of thought (which I don't /necessarily/ subscribe to) that
says, "If you don't know what you're doing, don't start changing kernel
sources" :) But I think you're probably right here. OTOH, if one looks at
the kernel source and sees lots of gotos, is the likelihood (a) that the
person who wrote it really couldn't code to save his life, or (b) that they're
there for a good reason which the observer doesn't know about? In general I'd
say (b) was more likely.

One of the people I used to (and occasionally still do) work with used to
comment every single line of his C code with a translation of the C code to
English. My argument is always that you should comment (pref. with block
comments) why your code is doing something, not what it is doing. (i.e. if
you can't read C, you shouldn't be looking at or modifying C programs). I've
not won that particular battle yet, and fear I never will.

I should say at this point, of course, that I know very little about kernel
coding myself :)

<ducks and runs>

s.

-- 
There was a young man of St. John's
Who wanted to bugger the swans.
        But the loyal hall porter
        Said, "Pray take my daughter!
Those birds are reserved for the dons."    

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/