lkml.org 
[lkml]   [2004]   [Jul]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] Use NULL instead of integer 0 in security/selinux/


On Thu, 8 Jul 2004, Timothy Miller wrote:
>
> Not to be picky, and I realize that we're not using C++ here, and it may
> not apply, but every C++ text I've read deprecates NULL and says to use
> 0. That is, THE WAY that you specify a null pointer in C++ is with a
> zero. It's no surprise that C programmers might pick up that habit.

It's a bad habit, and it's one (of many) bad things C++ does. The sad part
is that C++ does it for all the wrong reasons - there's no reason to not
realize that ((void *)0) is an even better special case, and indeed last I
heard at least gcc does allow that in C++ too.

The fact is, when somebody else picks up a mistake, that doesn't make it
any less of a mistake. And it's not like C++ is the paragon of good taste
anyway.

I've seen too damn many people mistake NULL and NUL (admit it, you've seen
it too), and I've seen code like

char c = NULL;

and any system where that goes through without a warning is totally
broken. And yes, that includes a _lot_ of C++ braindamages.

Linus
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2009-11-18 23:46    [from the cache]
©2003-2014 Jasper Spaans. Advertise on this site