Messages in this thread | | | Subject | Re: [PATCH] Use NULL instead of integer 0 in security/selinux/ | From | Alexandre Oliva <> | Date | 14 Jul 2004 00:12:22 -0300 |
| |
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/
| |