[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 2/3] qobject: assume base of a qobject is at off
From: |
Marc-André Lureau |
Subject: |
Re: [Qemu-devel] [PATCH 2/3] qobject: assume base of a qobject is at offset 0 |
Date: |
Wed, 21 Mar 2018 17:59:24 +0100 |
Hi
On Wed, Mar 21, 2018 at 5:23 PM, Paolo Bonzini <address@hidden> wrote:
> On 21/03/2018 17:11, Marc-André Lureau wrote:
>> Hi
>>
>> On Wed, Mar 21, 2018 at 5:00 PM, Paolo Bonzini <address@hidden> wrote:
>>> On 21/03/2018 16:55, Marc-André Lureau wrote:
>>>> That would work with an anonymous union though:
>>>>
>>>> struct QObject {
>>>> union {
>>>> QType type;
>>>> QType base;
>>>> };
>>>> size_t refcnt;
>>>> };
>>>>
>>>> If it's acceptable, I think I'll take this approach.
>>>
>>> You don't need QEMU_GENERIC at all then, don't you?
>>
>> Ah ah, that's what I thought too, but the type of QObject * &x->base
>> isn't QObject * :)
>>
>> I don't think we can fool it there (without loosing some type safety)
>
> Hmm, perhaps by making it "struct {} base"?
>
> Or even:
>
> struct QObjectCommon {
> QType type;
> size_t refcnt;
> }
>
> struct QObject {
> QObjectCommon base;
> }
>
> struct QString {
> QObjectCommon base;
> ...
> }
I fail to see what that solves. You are moving the problem to
QObjectCommon: we would have to replace all QObject * user to take
QObjectCommon *, and then we wouldn't solve the problem for
QObjectCommon.
--
Marc-André Lureau
- Re: [Qemu-devel] [PATCH 2/3] qobject: assume base of a qobject is at offset 0, (continued)
- Re: [Qemu-devel] [PATCH 2/3] qobject: assume base of a qobject is at offset 0, Marc-André Lureau, 2018/03/21
- Re: [Qemu-devel] [PATCH 2/3] qobject: assume base of a qobject is at offset 0, Eric Blake, 2018/03/21
- Re: [Qemu-devel] [PATCH 2/3] qobject: assume base of a qobject is at offset 0, Marc-André Lureau, 2018/03/21
- Re: [Qemu-devel] [PATCH 2/3] qobject: assume base of a qobject is at offset 0, Paolo Bonzini, 2018/03/21
- Re: [Qemu-devel] [PATCH 2/3] qobject: assume base of a qobject is at offset 0, Eric Blake, 2018/03/21
- Re: [Qemu-devel] [PATCH 2/3] qobject: assume base of a qobject is at offset 0, Paolo Bonzini, 2018/03/21
- Re: [Qemu-devel] [PATCH 2/3] qobject: assume base of a qobject is at offset 0, Marc-André Lureau, 2018/03/21
- Re: [Qemu-devel] [PATCH 2/3] qobject: assume base of a qobject is at offset 0, Paolo Bonzini, 2018/03/21
- Re: [Qemu-devel] [PATCH 2/3] qobject: assume base of a qobject is at offset 0, Marc-André Lureau, 2018/03/21
- Re: [Qemu-devel] [PATCH 2/3] qobject: assume base of a qobject is at offset 0, Paolo Bonzini, 2018/03/21
- Re: [Qemu-devel] [PATCH 2/3] qobject: assume base of a qobject is at offset 0,
Marc-André Lureau <=
- Re: [Qemu-devel] [PATCH 2/3] qobject: assume base of a qobject is at offset 0, Eric Blake, 2018/03/21
- Re: [Qemu-devel] [PATCH 2/3] qobject: assume base of a qobject is at offset 0, Marc-André Lureau, 2018/03/21
- Re: [Qemu-devel] [PATCH 2/3] qobject: assume base of a qobject is at offset 0, Eric Blake, 2018/03/21
- Re: [Qemu-devel] [PATCH 2/3] qobject: assume base of a qobject is at offset 0, Paolo Bonzini, 2018/03/21
[Qemu-devel] [PATCH 3/3] qobject: replace qobject_incref/QINCREF qobject_decref/QDECREF, Marc-André Lureau, 2018/03/21
Re: [Qemu-devel] [PATCH 0/3] RFC: simplify qobject refcount, Eric Blake, 2018/03/21