qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 08/14] qapi: convert eject (qmp and hmp) to QAPI


From: Avi Kivity
Subject: Re: [Qemu-devel] [PATCH 08/14] qapi: convert eject (qmp and hmp) to QAPI
Date: Thu, 25 Aug 2011 17:03:11 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:6.0) Gecko/20110816 Thunderbird/6.0

On 08/25/2011 04:52 PM, Kevin Wolf wrote:
>
>  It's not pretty, but it lets us preserve compatibility.  I think it's
>  also safer for dealing with pointers because otherwise you have a mix of
>  pointers that may be null and may not be null.  Having a clear
>  indication of which pointers are nullable makes for safer code.

I'm not saying that implementing a default value in generic (or
generated) code works for all cases. But if the schema supported default
values, we could get rid of the parameter in all simple cases (which I
would expect to be the majority); and if there is no default value in
the schema, we could still generate the has_* parameters.


An alternative is to pass a struct by value, with a .valid bool followed by the actual value (which should be initialized even if not valid, just to be safe).

--
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]