qemu-devel
[Top][All Lists]
Advanced

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

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


From: Markus Armbruster
Subject: Re: [Qemu-devel] [PATCH v6 1/5] qobject: ensure base is at offset 0
Date: Tue, 24 Apr 2018 17:24:56 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux)

Peter Maydell <address@hidden> writes:

> On 24 April 2018 at 13:18, Markus Armbruster <address@hidden> 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_PARENT(me); then the QOM cast will assert
> on you, so you'll figure it out pretty quickly...

Same for QObject & friends, where qobject_to() asserts.

Marc-André's argument for adding more checks was the possibility of
someone doing MyParent *p = (MyParent *)me without running into
MY_PARENT(me).



reply via email to

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