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

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

From: Jan Engelhardt <hidden>
Date: 2021-10-05 19:06:41
Also in: lkml, netfilter-devel, rcu

On Tuesday 2021-10-05 20:40, Steven Rostedt wrote:
quoted
quoted
quoted
quoted
quoted
typeof(*p) *________p1 = (typeof(*p) *__force)READ_ONCE(p);  
#define static_cast(type, expr) ((struct { type x; }){(expr)}.x)
typeof(p) p1 = (typeof(p) __force)static_cast(void *, READ_ONCE(p));

Let the name not fool you; it's absolutely _not_ the same as C++'s 
static_cast, but still: it does emit a warning when you do pass an 
integer, which is better than no warning at all in that case.

 *flies away*
Are you suggesting I should continue this exercise ;-)
“After all, why not?”

typeof(p) p1 = (typeof(p) __force)READ_ONCE(p) +
               BUILD_BUG_ON_EXPR(__builtin_classify_type(p) != 5);
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help