Re: [RFC][PATCH] rcu: Use typeof(p) instead of typeof(*p) *

From: Linus Torvalds
Date: Tue Oct 05 2021 - 12:18:45 EST


On Tue, Oct 5, 2021 at 6:47 AM Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:
>
> Also had to update a lot of the function pointer initialization in the
> networking code, as a function address must be passed as an argument in
> RCU_INIT_POINTER() and not just the function name, otherwise the following
> error occurs:

Ugh.

I think this is a sign of why we did it the way we did with that odd
"typeof(*p)*" thing in the first place.

The thing is, in any normal C, the function name should just stand in
for the pointer to the function, so having to add a '&' to get the
function pointer is somehow odd..

So I think you should just expose your type to anybody who uses a pointer to it.

Linus