lkml.org 
[lkml]   [2021]   [Oct]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    From
    Date
    SubjectRe: [RFC][PATCH] rcu: Use typeof(p) instead of typeof(*p) *
    On Tue, Oct 5, 2021 at 1:38 PM Steven Rostedt <rostedt@goodmis.org> wrote:
    >
    > Really, thinking about abstraction, I don't believe there's anything wrong
    > with returning a pointer of one type, and then typecasting it to a pointer
    > of another type. Is there? As long as whoever uses the returned type does
    > nothing with it.

    Just stop doing this.,

    Dammit, just include the header file that defines the type in the
    places that you use the thing.

    Because, yes, there is a LOT wrong with just randomly casting pointers
    that you think have the "wrong type". You're basically taking it on
    yourself to lie to the compiler, and intentionally breaking the type
    system, because you have some completely bogus reason to hide a type.

    We don't hide types in the kernel for no good reason.

    You are literally talking about making things worse, for a reason that
    hasn't even been explained, and isn't valid in the first place.
    Nothing else in the kernel has had a problem just declaring the damn
    type,.

    If there was some clean and simple solution to the compiler warning
    problem, that would be one thing. But when you think you need to
    change core RCU macros, or lie to the compiler about the type system,
    at that point it's not some clean and simple fix any more. At that
    point you're literally making things worse than just exposing the
    type.

    Linus

    \
     
     \ /
      Last update: 2021-10-05 22:47    [W:3.177 / U:0.220 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site