Linux bluetooth development
 help / color / mirror / Atom feed
From: Marcel Holtmann <marcel@holtmann.org>
To: Lucas De Marchi <lucas.demarchi@profusion.mobi>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH 1/2] Add common macro for safely deriving the size of array
Date: Fri, 01 Jul 2011 14:59:02 -0700	[thread overview]
Message-ID: <1309557544.8855.5.camel@aeonflux> (raw)
In-Reply-To: <1309546401-19867-1-git-send-email-lucas.demarchi@profusion.mobi>

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.

Regards

Marcel



  parent reply	other threads:[~2011-07-01 21:59 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 ` Marcel Holtmann [this message]
2011-07-01 22:32   ` [PATCH 1/2] Add common macro for safely deriving the size of array Lucas De Marchi

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=1309557544.8855.5.camel@aeonflux \
    --to=marcel@holtmann.org \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=lucas.demarchi@profusion.mobi \
    /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