Messages in this thread |  | | From | Linus Torvalds <> | Date | Sat, 12 Mar 2022 13:43:50 -0800 | Subject | Re: [PATCH 2/6] list: add new MACROs to make iterator invisiable |
| |
On Sat, Mar 12, 2022 at 2:24 AM Michał Mirosław <mirq-linux@rere.qmqm.pl> 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
|  |