public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Thomas Hood <jdthood@mail.com>
To: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Combined APM patch
Date: 11 Jan 2002 10:22:24 -0500	[thread overview]
Message-ID: <1010762545.788.2.camel@thanatos> (raw)

>> Is it not good practice to note when the code _assumes_ zero-
>> initialization?  I have seen comments like these elsewhere in
>> the kernel sources.
>
> Comments should _not_ echo code.  One should assumes that the reader
> knows the language.  Instead, comments should explain _what the
> purpose_  of that line of code or section of code is if it is not
> obvious to those that the comments are written to.

I agree that comments should not try to explain C to the
reader.  Comments should provide additional information,
such as telling the reader what the code is supposed to
do (as opposed to what it actually does, which may or may
not be the same thing).

In the line
    static int suspends_pending; /* = 0 */
the comment is not there to tell the reader that the variable
is initialized to zero.  It is there to tell the reader that
the variable _needs to be_ initialized to zero in order for
the code to work properly.  This is useful information,
because if someone later wants to modify the code to make
this variable non-static, the comment tells that person that
the variable will need an initializer.

--
Thomas






             reply	other threads:[~2002-01-11 15:22 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-01-11 15:22 Thomas Hood [this message]
2002-01-11 15:40 ` [PATCH] Combined APM patch Russell King
2002-01-18 10:43   ` Thomas Hood
2002-01-18 10:57     ` Russell King
  -- strict thread matches above, loose matches on Subject: below --
2002-01-10 18:37 Bob Toxen
2002-01-10 16:20 David Balazic
2002-01-07  4:52 Stephen Rothwell
2002-01-10 12:51 ` Thomas Hood
2002-01-12  9:43 ` Borsenkow Andrej
2002-01-27  8:39 ` Borsenkow Andrej

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1010762545.788.2.camel@thanatos \
    --to=jdthood@mail.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox