From: Eric Blake <eblake@redhat.com>
To: Pawit Pornkitprasan <p.pawit@gmail.com>
Cc: Ryousei Takano <takano-ryousei@aist.go.jp>,
qemu-devel@nongnu.org, Juan Quintela <quintela@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] migration: don't use uninitialized variables
Date: Fri, 19 Jul 2013 05:13:19 -0600 [thread overview]
Message-ID: <51E91F4F.9090400@redhat.com> (raw)
In-Reply-To: <CAJA5wJSVe2Ko2s5VRtgXhmDzr-5sSjY9tGXF9rDqAuoNhj5QDw@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1337 bytes --]
On 07/19/2013 05:04 AM, Pawit Pornkitprasan wrote:
> On Fri, Jul 19, 2013 at 7:57 PM, Eric Blake <eblake@redhat.com> wrote:
>>
>> However, wouldn't it be nice if we improved the qapi generator to
>> guarantee a sane default value for optional parameters, even when
>> has_value is false?
>>
>
> I'm not a qemu expert or anything, but wouldn't that destroy the point
> of has_value in the first place?
There are two uses for has_value. One: on output, the user knows
whether the variable has been set to anything sane. Two: on input, the
receiver knows if the caller passed an optional value. For output,
has_value is always needed. But for input, we could probably simplify a
LOT of code if 'value' already had a sane default of 0, without having
to first check 'has_value', instead of the current state where 'value'
must be treated as uninitialized if 'has_value' is false. Improving the
qapi generator to guarantee 0 value of optional parameters that were not
specified in JSON should not block your patch (it would be a series by
itself), it's just a question of whether it is worth making the change
and the resulting simplifications we can make to code that can assume
sane default values.
--
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: 621 bytes --]
next prev parent reply other threads:[~2013-07-19 11:13 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-19 2:36 [Qemu-devel] [PATCH] migration: don't use uninitialized variables Pawit Pornkitprasan
2013-07-19 10:57 ` Eric Blake
2013-07-19 11:04 ` Pawit Pornkitprasan
2013-07-19 11:13 ` Eric Blake [this message]
2013-07-29 21:05 ` Luiz Capitulino
2013-07-30 0:15 ` Markus Armbruster
2013-07-30 1:29 ` Anthony Liguori
2013-07-30 6:39 ` Markus Armbruster
2013-07-30 13:26 ` Anthony Liguori
2013-07-30 15:22 ` Markus Armbruster
2013-07-22 7:32 ` Orit Wasserman
2013-07-29 20:52 ` Luiz Capitulino
2013-07-29 23:29 ` Pawit Pornkitprasan
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=51E91F4F.9090400@redhat.com \
--to=eblake@redhat.com \
--cc=p.pawit@gmail.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
--cc=takano-ryousei@aist.go.jp \
/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.