[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 03/11] configure: Fix compiler warning in config
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH 03/11] configure: Fix compiler warning in config.log (integer from pointer) |
Date: |
Sat, 17 Dec 2011 07:18:55 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:8.0) Gecko/20111115 Thunderbird/8.0 |
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 address@hidden +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
[Qemu-devel] [PATCH 02/11] configure: Fix compiler warnings in config.log (old-style function definition), Stefan Weil, 2011/12/17
[Qemu-devel] [PATCH 04/11] configure: Fix compiler warnings in config.log (null arguments), Stefan Weil, 2011/12/17
[Qemu-devel] [PATCH 05/11] configure: Fix compiler warning in config.log (unused variable), Stefan Weil, 2011/12/17
[Qemu-devel] [PATCH 06/11] configure: Fix compiler warning in config.log (macro redefined), Stefan Weil, 2011/12/17
[Qemu-devel] [PATCH 08/11] configure: Fix compiler warning in config.log (undefined NULL), Stefan Weil, 2011/12/17
[Qemu-devel] [PATCH 09/11] configure: Fix compiler warning in config.log (value was never used), Stefan Weil, 2011/12/17
[Qemu-devel] [PATCH 10/11] configure: Fix compiler warnings in config.log (statement without effect), Stefan Weil, 2011/12/17
[Qemu-devel] [PATCH 07/11] configure: Fix compiler warnings in config.log (uninitialized variable), Stefan Weil, 2011/12/17