qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] QAPI and empty structs


From: Peter Maydell
Subject: Re: [Qemu-devel] QAPI and empty structs
Date: Mon, 12 Jan 2015 15:33:22 +0000

On 12 January 2015 at 15:31, Markus Armbruster <address@hidden> wrote:
> Eric Blake <address@hidden> writes:
>> On 12/23/2014 08:50 AM, Peter Maydell wrote:
>>> Although you could argue that we don't care about differences
>>> in C and C++ semantics, having a zero-sized struct floating
>>> around seems a bit risky to me, since for instance a naive
>>> attempt to g_malloc() space for it will return NULL.
>>
>> Oh, good point.
>
> Less of an issue than with malloc(), because NULL isn't both an error
> and a success value.

No, it's just a value that pretty much no caller is going
to expect to get and which they're very likely to be buggy
in dealing with...

>>> How should we handle these? Should the qapi-types generator
>>> stick a dummy field in so they aren't zero sized?
>>
>> Sounds like the best plan to me.
>
> I wouldn't bother myself, but if somebody posted working patches, I
> wouldn't bother objecting to the idea, either.

http://patchwork.ozlabs.org/patch/423777/  :-)

-- PMM



reply via email to

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