[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+55aFz0c43QARhefvhdiB=H6buO7VpEOnNbuJTYEcUn8M+mKw@mail.gmail.com>
Date: Fri, 13 Apr 2012 15:24:06 -0700
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Peter Seebach <peter.seebach@...driver.com>
Cc: Lubos Lunak <l.lunak@...e.cz>,
Andrew Morton <akpm@...ux-foundation.org>,
linux-kernel@...r.kernel.org, Arnd Bergmann <arnd@...db.de>
Subject: Re: [PATCH][RESEND] do not redefine userspace's NULL #define
On Fri, Apr 13, 2012 at 3:01 PM, Peter Seebach
<peter.seebach@...driver.com> 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'.
Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists