mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alexey Dobriyan <adobriyan@gmail.com>
To: Russ Dill <russ.dill@gmail.com>
Cc: Eric Miao <eric.y.miao@gmail.com>,
	Cyrill Gorcunov <gorcunov@gmail.com>,
	linux-arm-kernel@lists.arm.linux.org.uk,
	Ben Dooks <ben-linux@fluff.org>,
	linux-kernel@vger.kernel.org
Subject: Re: kernel.h: add ARRAY_AND_SIZE() macro to complement ARRAY_SIZE().
Date: Fri, 19 Sep 2008 21:55:44 +0400	[thread overview]
Message-ID: <20080919175544.GA3228@x200.localdomain> (raw)
In-Reply-To: <f9d2a5e10809190828g54a824b9od1ade53c96a518c8@mail.gmail.com>

On Fri, Sep 19, 2008 at 08:28:45AM -0700, Russ Dill wrote:
> My vote is for ARRAY_AND_SIZE to spread far and wide across the land.
> ARRAY_SIZE is already very safe, as it has a __must_be_array macro
> built in. So ARRAY_AND_SIZE is even safer, as it prevents you from
> mixing up two different arrays. It also reduces line length and makes
> driver and device (usually platform_device) registration code easier
> to read.

It also spreads ARRAY_SIZE misnaming futher.

It introduces one more core macro and quite pointless one. I can't
personally recall a single bug where sizeof() was taken from another
array.

It creates interesting confusion point: ARRAY_AND_SIZE is about array
and it's size. What ARRAY_SIZE is about then?

You want default argument values in fact, but C is C.

	Alexey "(array (nr (length array)))" Dobriyan

  reply	other threads:[~2008-09-19 17:53 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-18 13:24 Ben Dooks
2008-09-18 15:06 ` Alexey Dobriyan
2008-09-18 18:38   ` Eric Miao
2008-09-19  6:54     ` Cyrill Gorcunov
2008-09-19  7:22       ` Eric Miao
2008-09-19  7:32         ` Cyrill Gorcunov
2008-09-19 13:28         ` Stefan Richter
2008-09-19 15:28         ` Russ Dill
2008-09-19 17:55           ` Alexey Dobriyan [this message]
2008-09-20 13:05             ` Christer Weinigel
2008-09-20 13:45               ` Cyrill Gorcunov
2008-09-20 14:28                 ` Christer Weinigel
2008-09-20 14:45                   ` Cyrill Gorcunov
2008-09-20 16:38                     ` Christer Weinigel
2008-09-20 17:12                       ` Cyrill Gorcunov
2008-09-20 17:33                         ` Cyrill Gorcunov
2008-09-20 22:07               ` Chris Moore

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=20080919175544.GA3228@x200.localdomain \
    --to=adobriyan@gmail.com \
    --cc=ben-linux@fluff.org \
    --cc=eric.y.miao@gmail.com \
    --cc=gorcunov@gmail.com \
    --cc=linux-arm-kernel@lists.arm.linux.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=russ.dill@gmail.com \
    /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®