On 12 January 2015 at 15:31, Markus Armbruster <arm...@redhat.com> wrote: > Eric Blake <ebl...@redhat.com> 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