lkml.org 
[lkml]   [2004]   [Jul]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] Use NULL instead of integer 0 in security/selinux/
From
Date
On Jul 13, 2004, Geert Uytterhoeven <geert@linux-m68k.org> wrote:

> On Sun, 11 Jul 2004, Olaf Titz wrote:
>> in C. (Worse in C++ where usage of NULL is discouraged, I've always
>> wondered about the reasons.)

> [ wondered about this as well, but the answer has been posted before in this
> thread ]

> Because C++ doesn't do implicit conversions from void * to anything *.

So what? NULL must have an integral type in C++. void* is explicitly
forbidding in the C++ Standard.

I don't see that NULL is discouraged in C++. It's mostly redundant,
like it is in C, and it's not safe for varargs even on machines where
NULL pointers are represented can be zero-initialized, because
pointers to members and regular pointers don't even have the same
size, unlike C, that doesn't have pointers to members and thus can
safely use (intptr_t)0 for NULL and it will even work for varargs
(given the considerations above).

--
Alexandre Oliva http://www.ic.unicamp.br/~oliva/
Red Hat Compiler Engineer aoliva@{redhat.com, gcc.gnu.org}
Free Software Evangelist oliva@{lsd.ic.unicamp.br, gnu.org}
-
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: 2005-03-22 14:04    [W:0.640 / U:0.452 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site