From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:54101) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QwaWb-0002K2-Oy for qemu-devel@nongnu.org; Thu, 25 Aug 2011 10:03:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QwaWa-0005gw-Oh for qemu-devel@nongnu.org; Thu, 25 Aug 2011 10:03:17 -0400 Received: from mx1.redhat.com ([209.132.183.28]:16322) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QwaWa-0005gq-Ff for qemu-devel@nongnu.org; Thu, 25 Aug 2011 10:03:16 -0400 Message-ID: <4E56561F.7020208@redhat.com> Date: Thu, 25 Aug 2011 17:03:11 +0300 From: Avi Kivity MIME-Version: 1.0 References: <1314211389-28915-1-git-send-email-aliguori@us.ibm.com> <1314211389-28915-9-git-send-email-aliguori@us.ibm.com> <4E563DD9.7030406@redhat.com> <4E5650B8.9040809@codemonkey.ws> <4E5653B4.9030206@redhat.com> In-Reply-To: <4E5653B4.9030206@redhat.com> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 08/14] qapi: convert eject (qmp and hmp) to QAPI List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: qemu-devel@nongnu.org, Michael Roth , Luiz Capitulino 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.