From: Lucas De Marchi <lucas.demarchi@profusion.mobi>
To: Marcel Holtmann <marcel@holtmann.org>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH 1/2] Add common macro for safely deriving the size of array
Date: Fri, 1 Jul 2011 19:32:06 -0300 [thread overview]
Message-ID: <BANLkTikkQYXvJGqtXH2ecywO2OWaqAf2WQ@mail.gmail.com> (raw)
In-Reply-To: <1309557544.8855.5.camel@aeonflux>
Hi Marcel,
On Fri, Jul 1, 2011 at 6:59 PM, Marcel Holtmann <marcel@holtmann.org> wrote:
>
> Hi Lucas,
>
> > This provides a simple ARRAY_SIZE() macro, which (given a good compiler)
> > will also break compile if you try to use it on a pointer. This can
> > ensure your code is robust to changes, without needing a gratuitous
> > macro or constant. Credits to Rusty Russell
> > (http://ccan.ozlabs.org/info/array_size.html)
> >
> > Having a util.h file, this kind of things can be shared among all users
> > and we can remove all the declarations of ARRAY_SIZE.
> > ---
> > acinclude.m4 | 22 ++++++++++++++++++++++
> > configure.ac | 1 +
> > src/util.h | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
> > 3 files changed, 78 insertions(+), 0 deletions(-)
> > create mode 100644 src/util.h
>
> I am not sure that I actually want this. Where are the use cases of
> ARRAY_SIZE actually. Maybe we should just change them with proper NULL
> terminated arrays or other constants.
The uses cases are in the second patch. I added this because I was
going to use it for the AVRCP patches.
Why do you prefer NULL terminated arrays in case the content is static?
Regards,
Lucas De Marchi
prev parent reply other threads:[~2011-07-01 22:32 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-01 18:53 [PATCH 1/2] Add common macro for safely deriving the size of array Lucas De Marchi
2011-07-01 18:53 ` [PATCH 2/2] Use new macro for ARRAY_SIZE Lucas De Marchi
2011-07-01 21:59 ` [PATCH 1/2] Add common macro for safely deriving the size of array Marcel Holtmann
2011-07-01 22:32 ` Lucas De Marchi [this message]
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=BANLkTikkQYXvJGqtXH2ecywO2OWaqAf2WQ@mail.gmail.com \
--to=lucas.demarchi@profusion.mobi \
--cc=linux-bluetooth@vger.kernel.org \
--cc=marcel@holtmann.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