All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-trivial@nongnu.org, Stefan Weil <sw@weilnetz.de>,
	qemu-devel@nongnu.org
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	[thread overview]
Message-ID: <4EECA4CF.5030407@redhat.com> (raw)
In-Reply-To: <CAFEAcA-Dpy1a-hsN6oxPn6M=3LTwtfpR2c8J2Gz_a7-TfYQv-A@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1086 bytes --]

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   eblake@redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 620 bytes --]

  reply	other threads:[~2011-12-17 14:19 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-17  8:27 [Qemu-devel] [PATCH 00/11] configure: Fix compiler warnings in config.log Stefan Weil
2011-12-17  8:27 ` [Qemu-devel] [PATCH 01/11] configure: Fix compiler warnings in config.log (always return a value from main) Stefan Weil
2011-12-17  8:27 ` [Qemu-devel] [PATCH 02/11] configure: Fix compiler warnings in config.log (old-style function definition) Stefan Weil
2011-12-17  8:27 ` [Qemu-devel] [PATCH 03/11] configure: Fix compiler warning in config.log (integer from pointer) Stefan Weil
2011-12-17 11:29   ` Peter Maydell
2011-12-17 12:11     ` Stefan Weil
2011-12-17 14:09       ` Peter Maydell
2011-12-17 14:18         ` Eric Blake [this message]
2011-12-17 16:46   ` [Qemu-devel] [PATCH v2 " Stefan Weil
2011-12-17 16:57     ` Peter Maydell
2011-12-17  8:27 ` [Qemu-devel] [PATCH 04/11] configure: Fix compiler warnings in config.log (null arguments) Stefan Weil
2011-12-17  8:27 ` [Qemu-devel] [PATCH 05/11] configure: Fix compiler warning in config.log (unused variable) Stefan Weil
2011-12-17  8:27 ` [Qemu-devel] [PATCH 06/11] configure: Fix compiler warning in config.log (macro redefined) Stefan Weil
2011-12-17  8:27 ` [Qemu-devel] [PATCH 07/11] configure: Fix compiler warnings in config.log (uninitialized variable) Stefan Weil
2011-12-17  8:27 ` [Qemu-devel] [PATCH 08/11] configure: Fix compiler warning in config.log (undefined NULL) Stefan Weil
2011-12-17  8:27 ` [Qemu-devel] [PATCH 09/11] configure: Fix compiler warning in config.log (value was never used) Stefan Weil
2011-12-17  8:27 ` [Qemu-devel] [PATCH 10/11] configure: Fix compiler warnings in config.log (statement without effect) Stefan Weil
2011-12-17  8:27 ` [Qemu-devel] [PATCH 11/11] configure: Improve Xen autodetection for hosts without Xen Stefan Weil
2012-01-04 17:00   ` Stefano Stabellini
2011-12-17 11:43 ` [Qemu-devel] [PATCH 00/11] configure: Fix compiler warnings in config.log Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4EECA4CF.5030407@redhat.com \
    --to=eblake@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    --cc=sw@weilnetz.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.