[lkml]   [2012]   [Apr]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: [PATCH][RESEND] do not redefine userspace's NULL #define
    On Fri, Apr 13, 2012 at 3:01 PM, Peter Seebach
    <> wrote:
    > I was going to dispute this, and point out that I'm pretty sure
    > the C++ standard specifically requires the plain-integer 0/0L
    > definition.  Then I realized this did not actually contradict
    > your description.

    Yeah, the C++ definition i spure crap. Although I think even the worst
    C++ people realized that, and realized that they were wrong. So most
    of them seem to have figured out that defining NULL to 0 is insane and
    totally wrong.

    (IOW, if you don't get a warning for

    int i = NULL;

    or get a warning for passing NULL to a routine that takes "int", your
    language is pure and utter sh*t. Yes, K&R C made that mistake too, but
    it got fixed. The fact that the C++ people used to *codify* that
    insane braindamage is just sad).

    > Maybe the thing to do would be to ensure that NULL goes to __null,
    > then define that to be ((void *) 0) if the compiler doesn't provide
    > it?  The magic behavior of __null seems like it'd be preferable
    > where it is available.

    So if gcc guarantees that __null has the correct semantics, I could
    imagine replacing the kernel ((void *)0) with __null.

    But unless we *know* that the incoming NULL is good, there's no way I
    will let the kernel ever make the mistake of taking '0'.

    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to
    More majordomo info at
    Please read the FAQ at

     \ /
      Last update: 2012-04-14 00:27    [W:0.029 / U:23.184 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site