Re: [PATCH v3 1/4] array_size.h: Add ARRAY_END()

From: Alejandro Colomar
Date: Sun Nov 09 2025 - 14:18:56 EST


Hi Maciej,

On Sun, Nov 09, 2025 at 07:05:40PM +0000, Maciej W. Rozycki wrote:
> On Sun, 9 Nov 2025, Alejandro Colomar wrote:
>
> > diff --git a/include/linux/array_size.h b/include/linux/array_size.h
> > index 06d7d83196ca..b5775b8f13de 100644
> > --- a/include/linux/array_size.h
> > +++ b/include/linux/array_size.h
> > @@ -10,4 +10,10 @@
> > */
> > #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
> >
> > +/**
> > + * ARRAY_END - get a pointer to one past the last element in array @a
> > + * @a: array
> > + */
> > +#define ARRAY_END(a) (&(a)[ARRAY_SIZE(a)])
>
> Why `a' rather than `arr' as with the other macro?

It's simpler, and equally informative. I wish ARRAY_SIZE() would have
also used 'a'. On the other hand, consistency is important. I'll make
it 'arr'.

Thanks!


Have a lovely night!
Alex


>
> Maciej

--
<https://www.alejandro-colomar.es>
Use port 80 (that is, <...:80/>).

Attachment: signature.asc
Description: PGP signature