mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Robert P. J. Day" <rpjday@mindspring.com>
To: Dave Jones <davej@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	Arjan van de Ven <arjan@infradead.org>,
	Cyrill Gorcunov <gorcunov@gmail.com>,
	LKML <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Ingo Molnar <mingo@elte.hu>
Subject: Re: memset as memzero
Date: Sun, 23 Sep 2007 12:33:13 -0400 (EDT)	[thread overview]
Message-ID: <Pine.LNX.4.64.0709231226140.14224@localhost.localdomain> (raw)
In-Reply-To: <20070923153243.GE8127@redhat.com>

On Sun, 23 Sep 2007, Dave Jones wrote:

> There is one useful argument for memzero (or bzero to give it its
> proper name), and that's that it's impossible to screw up. I'm still
> amazed at how many times I see
>
> 	memset (x,size,0);
>
> in various code. So much so, that my editor highlights it now to
> spot it during code review.  As does my mail client.  To be on the
> safe side, I also have a cron job grepping for it in my
> ~/Mail/commits for all the projects I'm interested in.

  taking a step back, regardless of what constitutes a sane versus
not-sane definition of a useful macro, i think a lot of the content of
kernel.h could be moved out of there and put in a more appropriate
header file called, say, macros.h.

  the first comment in kernel.h claims that

/*
 * 'kernel.h' contains some often-used function prototypes etc
 */

but there's buckets more stuff in there than just some function
prototypes.  macros for type limits, alignment, array sizes, rounding,
and on and on.  and as for those prototypes, is there any reason that
kernel.h includes them explicitly for the contents of lib/vsprintf.c
rather than just including, say, a hypothetical vsprintf.h?  just
curious.

in any case, it would seem that kernel.h could stand a good cleaning.
it give the impression of just being an arbitrary dumping ground when
folks can't figure out where to put something.

rday
-- 
========================================================================
Robert P. J. Day
Linux Consulting, Training and Annoying Kernel Pedantry
Waterloo, Ontario, CANADA

http://crashcourse.ca
========================================================================

  parent reply	other threads:[~2007-09-23 16:35 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-22  8:33 Cyrill Gorcunov
2007-09-22  8:48 ` Robert P. J. Day
2007-09-22  9:35   ` Cyrill Gorcunov
2007-09-22  9:55     ` Robert P. J. Day
2007-09-22 10:15       ` Cyrill Gorcunov
2007-09-22 19:46 ` Arjan van de Ven
2007-09-22 18:53   ` Linus Torvalds
2007-09-23 15:32     ` Dave Jones
2007-09-23 16:07       ` Arnaldo Carvalho de Melo
2007-09-23 17:05         ` Linus Torvalds
2007-09-23 18:46           ` Willy Tarreau
2007-09-23 16:33       ` Robert P. J. Day [this message]
2007-09-23 16:46         ` Arnaldo Carvalho de Melo
2007-09-22 19:25   ` Bernd Eckenfels
2007-09-22 20:37     ` Oleg Verych (nntp)
2007-09-22 19:32   ` Cyrill Gorcunov

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=Pine.LNX.4.64.0709231226140.14224@localhost.localdomain \
    --to=rpjday@mindspring.com \
    --cc=akpm@linux-foundation.org \
    --cc=arjan@infradead.org \
    --cc=davej@redhat.com \
    --cc=gorcunov@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=torvalds@linux-foundation.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

all inboxes | Powered by JetHome®