Re: [PATCH 2/6] list: add new MACROs to make iterator invisiable

From: Linus Torvalds
Date: Sat Mar 12 2022 - 16:45:23 EST


On Sat, Mar 12, 2022 at 2:24 AM Michał Mirosław <mirq-linux@xxxxxxxxxxxx> wrote:
>
> The source type is not needed for the macros [..]

Ahh. Yeah, as long as we don't do typedefs, it looks like we don't
need to pre-declare the member access types.

I expected that to be required, because function declarations taking
arguments need it, but that's because they create their own scope.
Just doing it in a regular struct (or in this case union) declaration
is fine.

So we would only need that post-declaration.

That said, your naming is wrong. It's not just about "self". It's any
case where the type we iterate over is declared after the type that
has the head.

So I suspect it would be a lot better to just always do it, and not do
that "self vs non-self" distinction.

Linus