[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <200711151416.54570.mgerdau@tiscali.de>
Date: Thu, 15 Nov 2007 14:16:42 +0100
From: Michael Gerdau <mgerdau@...cali.de>
To: Philippe Elie <phil.el@...adoo.fr>
Cc: Russell Leighton <russ@...gant-software.com>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: OT: Does Linux have any "Perfect Code"
> This code is far to be perfect, some part is outdated, bcopy() use instead
> of memcpy() for example. More annoying are the comment, the file is 3306
> lines while there is only 1640 line of code, nothing bad per se but looking
> some comments:
>
> /*
> * Before we begin this operation, disable kernel preemption.
> */
> kpreempt_disable();
>
>
> uhh...
>
> or
>
> if (cyclic->cy_pend != 0) {
> /*
> * The pend is non-zero; ...
>
> I will never guessed that, w/o the comment :)
<disclaimer>
I'm not a kernel developer.
</disclaimer>
That having said:
I really do like such obvious (as in: for those knowing the stuff anyway)
comments when looking at code and probably concepts I'm not familiar with.
IMO there is no need to belittle this type of comment. IMO any casual
reader not familiar with the whole set of functions possibly involved
will be thankful for this type of comment - I certainly am.
> /*
> * We have both a left and a right child. We need to compare
> * the expiration times of the children to determine which
> * expires earlier.
> */
> if (cyclics[right].cy_expire < cyclics[left].cy_expire) {
>
> writing array[index] in C is already a promise than index is in
> [0-array size)
Yes. And ?
FWIW whenever I tried to look at kernel code I'm usually facing the
decision to
- either give up trying to understand what is intended or
- do a thorough search to learn everything required
I usually give up due to time constraints.
I mean, isn't the whole purpose of comments to help those not familiar
with the code to understand it's purpose and possibly the intention of
the author (just in case the author had coded a bug) ?
From my PoV this establishes a steep learning curve for "outsiders" to
start working on the kernel.
[just in case: don't give me anything along the line "this is an inherent
test as to the fitness of the potential hacker" ;]
Just my thoughts,
Michael
--
Vote against SPAM - see http://www.politik-digital.de/spam/
Michael Gerdau email: mgerdau@...cali.de
GPG-keys available on request or at public keyserver
Download attachment "signature.asc " of type "application/pgp-signature" (195 bytes)
Powered by blists - more mailing lists