public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Bob Toxen <bob@cavu.com>
To: jdthood@mail.com, linux-kernel@vger.kernel.org,
	linux-laptop@vger.kernel.org
Subject: Re: [PATCH] Combined APM patch
Date: Thu, 10 Jan 2002 13:37:12 -0500	[thread overview]
Message-ID: <200201101837.g0AIbCO02438@cavu.com> (raw)

> Just browsing the diff between my patch and Stephen's, I have
> a couple of questions.

> < static int			suspends_pending; /* = 0 */
> ---
> > static int			suspends_pending;

> 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.

Thus, the following should be considered correct:

static int			suspends_pending;

Both of the following lines have superfluous code or commants and should
be avoided:

static int			suspends_pending; /* = 0 */
static int			suspends_pending = 0;

Likewise, parentheses where none are needed just get in the way of useful
stuff and slows down understanding the program.  Some parentheses in
complex expressions or when the precedence of operator evaluation is
confusing, such as bitwise ops can be helpful.

Btw, I have been writing system-level c code for 26 years and learned by
reading and modifying Unix system code at Berkeley.

Best regards,

Bob Toxen, CTO
Fly-By-Day Consulting, Inc.           "Experts in Linux & network security"
bob@cavu.com
http://www.cavu.com                   [Linux/Unix & Network Security Consulting]
http://www.realworldlinuxsecurity.com [My 5* book: "Real World Linux Security"]
http://www.cavu.com/sunset.html       [Sunset Computer]
Quality Linux, UNIX and network security and software consulting since 1990.

GPG Public key available at http://www.cavu.com/pubkey.txt (book@cavu.com)
  and at http://pgp5.ai.mit.edu/pks-commands.html#extract
  and on the CD-ROM that comes sealed and attached to Real World Linux Security
pub  1024D/E3A1C540 2000-06-21 Bob Toxen <book@cavu.com>
     Key fingerprint = 30BA AA0A 31DD B68B 47C9  601E 96D3 533D E3A1 C540
sub  2048g/03FFCCB9 2000-06-21

             reply	other threads:[~2002-01-10 19:29 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-01-10 18:37 Bob Toxen [this message]
  -- strict thread matches above, loose matches on Subject: below --
2002-01-11 15:22 [PATCH] Combined APM patch Thomas Hood
2002-01-11 15:40 ` Russell King
2002-01-18 10:43   ` Thomas Hood
2002-01-18 10:57     ` Russell King
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=200201101837.g0AIbCO02438@cavu.com \
    --to=bob@cavu.com \
    --cc=jdthood@mail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-laptop@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