Re: [Qemu-devel] [PATCH v6 1/5] qobject: ensure base is at offset 0

2018-04-27 Thread Markus Armbruster
Marc-André Lureau writes: > All QObject types have the base QObject as their first field. This > allows the simplification of qobject_to(). > > This explicitly guarantees that existing casts work correctly (even > though we'd prefer to get rid of such casts in any location except the > qobject.h

Re: [Qemu-devel] [PATCH v6 1/5] qobject: ensure base is at offset 0

2018-04-26 Thread Markus Armbruster
Markus Armbruster writes: > Marc-André Lureau writes: > >> On Thu, Apr 19, 2018 at 5:20 PM, Eric Blake wrote: >>> On 04/19/2018 10:01 AM, Marc-André Lureau wrote: All QObject types have the base QObject as their first field. This allows the simplification of qobject_to(). Th

Re: [Qemu-devel] [PATCH v6 1/5] qobject: ensure base is at offset 0

2018-04-24 Thread Markus Armbruster
Peter Maydell writes: > On 24 April 2018 at 13:18, Markus Armbruster wrote: >> We define hundreds of QOM types without ever bothering to check the >> super type comes first. We don't even bother to clearly document it has >> to come first. > > If you don't put the super type first then the firs

Re: [Qemu-devel] [PATCH v6 1/5] qobject: ensure base is at offset 0

2018-04-24 Thread Peter Maydell
On 24 April 2018 at 13:18, Markus Armbruster wrote: > We define hundreds of QOM types without ever bothering to check the > super type comes first. We don't even bother to clearly document it has > to come first. If you don't put the super type first then the first time you do MyParent *p = MY_P

Re: [Qemu-devel] [PATCH v6 1/5] qobject: ensure base is at offset 0

2018-04-24 Thread Markus Armbruster
Marc-André Lureau writes: > On Thu, Apr 19, 2018 at 5:20 PM, Eric Blake wrote: >> On 04/19/2018 10:01 AM, Marc-André Lureau wrote: >>> All QObject types have the base QObject as their first field. This >>> allows the simplification of qobject_to(). >>> >>> This explicitly guarantees that existin

Re: [Qemu-devel] [PATCH v6 1/5] qobject: ensure base is at offset 0

2018-04-19 Thread Marc-André Lureau
On Thu, Apr 19, 2018 at 5:20 PM, Eric Blake wrote: > On 04/19/2018 10:01 AM, Marc-André Lureau wrote: >> All QObject types have the base QObject as their first field. This >> allows the simplification of qobject_to(). >> >> This explicitly guarantees that existing casts work correctly (even >> tho

Re: [Qemu-devel] [PATCH v6 1/5] qobject: ensure base is at offset 0

2018-04-19 Thread Eric Blake
On 04/19/2018 10:01 AM, Marc-André Lureau wrote: > All QObject types have the base QObject as their first field. This > allows the simplification of qobject_to(). > > This explicitly guarantees that existing casts work correctly (even > though we'd prefer to get rid of such casts in any location e

[Qemu-devel] [PATCH v6 1/5] qobject: ensure base is at offset 0

2018-04-19 Thread Marc-André Lureau
All QObject types have the base QObject as their first field. This allows the simplification of qobject_to(). This explicitly guarantees that existing casts work correctly (even though we'd prefer to get rid of such casts in any location except the qobject.h macros) Signed-off-by: Marc-André Lure