On 12/17/2011 07:09 AM, Peter Maydell wrote:
>> Typically NULL is defined to be ((void *)0 for C
>> (that's the reason why I used a type cast, too). Only for
>> C++ it is defined without a type cast.
> 
> The C standard permits plain "0" as a definition of NULL.

POSIX concurs with the C standard that a plain "0" can be used for
representing a null pointer, but requires that the macro NULL be defined
as ((void*)0) as a tighter requirement than C.

http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_244
http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/stddef.h.html#tag_13_47

> We use plain 0 for a null pointer constant in various
> existing tests in configure; this is simpler and avoids
> dragging in stddef.h. I would prefer that.

I agree that configure tests should be as small as possible while still
being correct, and use of a 0 constant without a cast, rather than NULL,
is appropriate in that context.

-- 
Eric Blake   ebl...@redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to