[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <c325748d-6faf-9fee-60ae-bf8b6b812c2a@gmail.com>
Date: Fri, 19 Nov 2021 16:13:29 +0100
From: "Alejandro Colomar (man-pages)" <alx.manpages@...il.com>
To: Alexey Dobriyan <adobriyan@...il.com>
Cc: linux-kernel@...r.kernel.org
Subject: Re: [PATCH 00/17] Add memberof(), split some headers, and slightly
simplify code
Hi Alexey,
On 11/19/21 16:07, Alexey Dobriyan wrote:
>> +#define memberof(T, m) (((T *) NULL)->m)
>> +
>> #define typeof_member(T, m) typeof(((T*)0)->m)
>
> No.
>
> Your macro exists already under different name.
>
> sizeof_member and typeof_member exist, you don't anything more.
>
The macro memberof() exists in one file (or 2)
under the name struct_member(), IIRC.
sizeof_member(), which is actually sizeof_field, IIRC,
and typeof_member(),
make use of this construction,
but they unnecessarily repeat it,
and there are other cases where code wants exactly memberof(),
not any of its wrappers.
I think that macro makes a lot of sense.
If you prefer the name struct_member() instead of memberof(),
I'm fine with it.
I just found that name much later than writing memberof(),
and memberof() was more consistent
with the typical naming of xxxof() for similar macros.
Thanks,
Alex
--
Alejandro Colomar
Linux man-pages comaintainer; https://www.kernel.org/doc/man-pages/
http://www.alejandro-colomar.es/
Powered by blists - more mailing lists