On 04/27/2018 03:24 AM, Markus Armbruster wrote: > Marc-André Lureau <marcandre.lur...@redhat.com> writes: > >> By moving the base fields to a QObjectBase_, QObject can be a type >> which also has a 'base' field. This allows writing a generic QOBJECT() >> macro that will work with any QObject type, including QObject >> itself. The container_of() macro ensures that the object to cast has a >> QObjectBase_ base field, giving some type safety guarantees. QObject >> must have no members but QObjectBase_ base, or else QOBJECT() breaks. >> >> QObjectBase_ is not a typedef and uses a trailing underscore to make >> it obvious it is not for normal use and to avoid potential abuse. > > The omission of typedef to signal "internal use" is unusual in QEMU. > Doesn't bother *me*, but then I wouldn't typedef any struct or union if > consistency with the bulk of QEMU's code didn't demand it. > > I can add the typedef and update the commit message if desired.
I'm fine if you leave the typedef out, without modifying anything. > >> Signed-off-by: Marc-André Lureau <marcandre.lur...@redhat.com> >> Reviewed-by: Eric Blake <ebl...@redhat.com> > > I would've been tempted to try an unnamed field, but (1) that might've > been too clever, and (2) this patch exists and works. > > With or without the typedef: > Reviewed-by: Markus Armbruster <arm...@redhat.com> > > -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature