On Fri, Apr 13, 2012 at 3:01 PM, Peter Seebach<peter.seebach@windriver.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 worstC++ people realized that, and realized that they were wrong. So mostof them seem to have figured out that defining NULL to 0 is insane andtotally 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", yourlanguage is pure and utter sh*t. Yes, K&R C made that mistake too, butit got fixed. The fact that the C++ people used to *codify* thatinsane 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 couldimagine replacing the kernel ((void *)0) with __null.

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