mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Darren Jenkins" <darrenrjenkins@gmail.com>
To: "Andi Drebes" <lists-receive@programmierforen.de>
Cc: "Jan-Benedict Glaw" <jbglaw@lug-owl.de>,
	kernel-janitors@lists.osdl.org,
	linux-kernel <linux-kernel@vger.kernel.org>,
	"Karsten Keil" <kkeil@suse.de>
Subject: Re: [KJ] Re: [PATCH] drivers/isdn/hisax: ARRAY_SIZE instead of sizeof
Date: Mon, 11 Jun 2007 22:25:31 +1000	[thread overview]
Message-ID: <82faac5b0706110525s56bade43rb24619b54687770d@mail.gmail.com> (raw)
In-Reply-To: <200706111120.07730.lists-receive@programmierforen.de>

G'day Andi,

On 6/11/07, Andi Drebes <lists-receive@programmierforen.de> wrote:

> > I'd suggest to not use another define, but use ARRAY_SIZE(foo)
> > _instead of_ eg. FNCOUNT.
> I thought of this, too, but I tried to keep things consistent. Let me
> explain that a little bit more in detail. If you have a look at the files
> in drivers/isdn/hisax then you will see that a lot of array size definitions
> are assigned to preprocessor macros. So I thought removing just one
> of the macros while the other continue to exist would make the code
> a little bit more inconsistent. However, one might disagree about that.
> So here's another patch that includes the changes from the original patch
> and removes the FNCOUNT preprocessor definition. Perhaps the original
> authors of the files should decide wether they want to keep it or not.

I think what was meant here was to remove _all_ the macros that you
assigned to the ARRAY_SIZE() macro.


If you look at the two advantages replacing code with the ARRAY_SIZE()
macro has;
1. More readable/consistent code.
2. Faster compile times, because of less macros being defined.

If you were to simply redefine other macro's to be an ARRAY_SIZE()
macro, the code will still contain the original macro's that people
will have to look up, so would _not_ be more readable/consistent and
you now have two stages of macro replacement, so the code will
actually take _longer_ to compile.

So to get the benefit of this change you have to _remove_ all the
macros that are somehow equivalent to ARRAY_SIZE(), and replace their
use in the code, with an appropriate ARRAY_SIZE() usage.

Darren J.

  reply	other threads:[~2007-06-11 12:25 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-10 10:35 Andi Drebes
2007-06-10 13:11 ` Karsten Keil
2007-06-10 13:14   ` Jan-Benedict Glaw
2007-06-11  9:20     ` Andi Drebes
2007-06-11 12:25       ` Darren Jenkins [this message]
2007-06-11 17:47         ` [KJ] " Karsten Keil
2007-06-11 18:53           ` Andi Drebes
2007-06-11 18:59           ` Jan-Benedict Glaw
2007-06-11 18:51         ` Andi Drebes

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=82faac5b0706110525s56bade43rb24619b54687770d@mail.gmail.com \
    --to=darrenrjenkins@gmail.com \
    --cc=jbglaw@lug-owl.de \
    --cc=kernel-janitors@lists.osdl.org \
    --cc=kkeil@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lists-receive@programmierforen.de \
    /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®