qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v5 0/5] Simplify qobject refcount


From: Markus Armbruster
Subject: Re: [Qemu-devel] [PATCH v5 0/5] Simplify qobject refcount
Date: Thu, 19 Apr 2018 08:44:08 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux)

Marc-André Lureau <address@hidden> writes:

> Hi,
>
> This series aims to get rid of the distinction between QObject, that
> must use qobject_incref/qobject_decref and its various derived types
> that have to use QINCREF/QDECREF. Instead, replace it with
> qobject_ref/qobject_unref for all types.

This is a lovely improvement.

However, I think the code can't quite decide whether to embrace or
eschew type casts between QObject and its subtypes.

On the one hand, we provide safe conversion macros QOBJECT() and
qobject_to().  By the way, shouting one but not the other is a bit ugly.

On the other hand, we still use type casts, and enforce "base comes
first" to make them work.

If we want to eschew type casts, we should clean up the remaining ones.
The case for "base must come first" is quite weak then.  Not worth the
bother, I think.

I doubt we want to embrace type casts here.  If we wanted to, I'd go all
the way and unwrap base in QObjects and its subtypes with suitable "must
match QObject" comments.  Alternatively, use an unnamed member.  Then
convert with type casts rather than container_of() and &->base.



reply via email to

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