| From | Arnd Bergmann <> | Date | Sun, 21 Nov 2021 14:22:35 +0100 | Subject | Re: [PATCH v2 17/20] linux/array_size.h: Add __is_array(a) to help readability |
| |
On Sat, Nov 20, 2021 at 2:01 PM Alejandro Colomar <alx.manpages@gmail.com> wrote: > > /* &a[0] degrades to a pointer: a different type from an array */ > -#define __must_be_array(a) __must_be(!__same_type((a), &(a)[0])) > +#define __is_array(a) (!__same_type((a), &(a)[0])) > + > +#define __must_be_array(a) __must_be(__is_array(a))
I'd go the other way here if you want to improve this, and open-code it to avoid nested macros. That produces more readable error messages with recent compilers that try to unwind each macro one at a time.
Arnd
|