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

From: Linus Torvalds
Date: Tue Oct 05 2021 - 17:34:07 EST


On Tue, Oct 5, 2021 at 2:09 PM Jan Engelhardt <jengelh@xxxxxxx> wrote:
>
> Illegal.
> https://en.cppreference.com/w/c/language/conversion
> subsection "Pointer conversion"
> "No other guarantees are offered"

Well, we happily end up casting pointers to 'unsigned long' and back,
and doing bit games on the low bits of a pointer value.

So it's not like the kernel deeply cares about theoretical portability.

But I do discourage casting when not required, just because as much
static type checking we can possibly have is good when we can do it.

Linus