qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 04/17] qapi: merge QInt and QFloat in QNum


From: Markus Armbruster
Subject: Re: [Qemu-devel] [PATCH 04/17] qapi: merge QInt and QFloat in QNum
Date: Fri, 02 Jun 2017 08:30:49 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux)

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

> Hi
>
> On Tue, May 30, 2017 at 6:23 PM Markus Armbruster <address@hidden> wrote:
>
>> Marc-André Lureau <address@hidden> writes:
>>
>> > Hi
>> >
>> > On Thu, May 11, 2017 at 6:30 PM Markus Armbruster <address@hidden> wrote:
[...]
>> >> g_assert_not_reached() is problematic, see "[PATCH] checkpatch: Disallow
>> >> glib asserts in main code".
>> >>
>> >> Message-Id: <address@hidden>
>> >> https://lists.gnu.org/archive/html/qemu-devel/2017-04/msg05499.html
>> >>
>> >>
>> > Actually g_assert() and g_assert_not_reached() are accepted.
>>
>> What exactly does g_assert() buy us over plain assert(), and
>> g_assert_not_reached() over assert(0)?
>>
>
> g_assert() brings a bit more context, afaik, can be trapped for error
> testing, and error reporting can be handled by an handler. Not that useful
> to qemu, but could be for the graphical UI though.
>
> g_assert_not_reached() is quite more readable than assert(0)

I'm all for making intent explicit, but what else could assert(0)
possibly mean?

>> qapi/ overwhelmingly uses assert().
>>
>
> ok, it's already a mix of assert & g_assert in qemu though

True.

In my opinion, we should use only one outside tests.  g_assert() if it
adds value, else plain assert().  "Outside tests", because g_assert()
might add sufficient value in tests even when it doesn't elsewhere.

Until then, I prefer to use only one *locally*.  In qapi/, that's plain
assert() now.



reply via email to

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