lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 12 Mar 2007 00:16:59 +0100 (MET)
From:	Jan Engelhardt <jengelh@...ux01.gwdg.de>
To:	Kyle Moffett <mrmacman_g4@....com>
cc:	Daniel Hazelton <dhazelton@...er.net>,
	Cong WANG <xiyou.wangcong@...il.com>,
	linux-kernel@...r.kernel.org
Subject: Re: Style Question


On Mar 11 2007 18:01, Kyle Moffett wrote:
> On Mar 11, 2007, at 16:41:51, Daniel Hazelton wrote:
>> On Sunday 11 March 2007 16:35:50 Jan Engelhardt wrote:
>> > On Mar 11 2007 22:15, Cong WANG wrote:
>> > > So can I say using NULL is better than 0 in kernel?
>> > 
>> > On what basis? Do you even know what NULL is defined as in (C, not
>> > C++) userspace? Think about it.
>> 
>> IIRC, the glibc and GCC headers define NULL as (void*)0  :)
>
> On the other hand when __cplusplus is defined they define it to the
> "__null" builtin, which GCC uses to give type conversion errors for
> "int foo = NULL" but not "char *foo = NULL".  A "((void *)0)"
> definition gives C++ type errors for both due to the broken C++
> void pointer conversion problems.

I think that the primary reason they use __null is so that you can
actually do

	class foo *ptr = NULL;

because

	class foo *ptr = (void *)0;

would throw an error or at least a warning (implicit cast from void*
to class foo*).


Jan
-- 
-
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ