Thread (32 messages) flat view 32 messages, 7 authors, 2021-10-12

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

From: Linus Torvalds <torvalds@linux-foundation.org>
Date: 2021-10-05 21:34:07
Also in: lkml, netfilter-devel, rcu

On Tue, Oct 5, 2021 at 2:09 PM Jan Engelhardt [off-list ref] 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help