Re: [PATCH 1/2] Add common macro for safely deriving the size of array

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux