linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Alejandro Colomar (man-pages)" <alx.manpages@gmail.com>
To: Alexey Dobriyan <adobriyan@gmail.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH 00/17] Add memberof(), split some headers, and slightly simplify code
Date: Fri, 19 Nov 2021 16:13:29 +0100	[thread overview]
Message-ID: <c325748d-6faf-9fee-60ae-bf8b6b812c2a@gmail.com> (raw)
In-Reply-To: <YZe9yYBvE038/w90@localhost.localdomain>

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/

  reply	other threads:[~2021-11-19 15:13 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-19 15:07 [PATCH 00/17] Add memberof(), split some headers, and slightly simplify code Alexey Dobriyan
2021-11-19 15:13 ` Alejandro Colomar (man-pages) [this message]
  -- strict thread matches above, loose matches on Subject: below --
2021-11-19 11:36 Alejandro Colomar
2021-11-19 12:47 ` Jani Nikula
2021-11-19 13:16   ` Alejandro Colomar (man-pages)
2021-11-19 13:48     ` Jani Nikula
2021-11-19 14:54     ` Andy Shevchenko
2021-11-19 14:47 ` Arnd Bergmann
2021-11-19 15:06   ` Alejandro Colomar (man-pages)
2021-11-19 15:34     ` Andy Shevchenko
2021-11-19 15:38       ` Alejandro Colomar (man-pages)
2021-11-19 15:43         ` Alejandro Colomar (man-pages)
2021-11-19 15:49           ` Andy Shevchenko
2021-11-19 15:52             ` Alejandro Colomar (man-pages)
2021-11-19 16:07               ` Andy Shevchenko
2021-11-19 15:57     ` Arnd Bergmann
2021-11-19 16:10       ` Andy Shevchenko
2021-11-19 16:18         ` Arnd Bergmann
2021-11-19 16:22           ` Alejandro Colomar (man-pages)
2021-11-19 16:27             ` Arnd Bergmann
2021-11-19 16:35             ` Andy Shevchenko
2021-11-22 12:36               ` Jonathan Cameron
2021-11-19 16:12       ` Alejandro Colomar (man-pages)
2021-11-19 16:25         ` Arnd Bergmann
2021-11-19 16:37         ` Andy Shevchenko
2021-11-19 16:49           ` Alejandro Colomar (man-pages)

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=c325748d-6faf-9fee-60ae-bf8b6b812c2a@gmail.com \
    --to=alx.manpages@gmail.com \
    --cc=adobriyan@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).