All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: Eric Blake <eblake@redhat.com>
Cc: kwolf@redhat.com, berto@igalia.com, mst@redhat.com,
	mdroth@linux.vnet.ibm.com, qemu-devel@nongnu.org,
	mreitz@redhat.com, lcapitulino@redhat.com,
	"Andreas Färber" <afaerber@suse.de>
Subject: Re: [Qemu-devel] [PATCH 1/2] qobject: Use 'bool' for qbool
Date: Mon, 18 May 2015 08:42:43 +0200	[thread overview]
Message-ID: <87pp5ytmho.fsf@blackfin.pond.sub.org> (raw)
In-Reply-To: <55577AA3.3060107@redhat.com> (Eric Blake's message of "Sat, 16 May 2015 11:13:07 -0600")

Eric Blake <eblake@redhat.com> writes:

> On 05/16/2015 07:30 AM, Andreas Färber wrote:
>> Am 16.05.2015 um 00:24 schrieb Eric Blake:
>>> We require a C99 compiler, so let's use 'bool' instead of 'int'
>>> when dealing with boolean values.  There are few enough clients
>>> to fix them all in one pass.
>>>
>>> Signed-off-by: Eric Blake <eblake@redhat.com>
>>> ---
>
>>>  /**
>>> - * qbool_from_int(): Create a new QBool from an int
>>> + * qbool_from_bool(): Create a new QBool from a bool
>>>   *
>>>   * Return strong reference.
      */
>> 
>> Can you fix the syntax as follow-up please?
>> 
>> /**
>>  * qbool_from_bool:
>>  * @value: ...
>>  *
>>  * Desc...
>>  *
>>  * Returns: ...
>>  */
>
> Sure, I can do that over all the qboject files, as a new patch.

Please don't, it's an egregious waste of screen space and the reader's
mental energy.

We're not using GTK-Doc for anything, and as long as we don't, I'm
unwilling to pay its price of admission.

If a maintainer prefers to enforce GTK-Doc comment syntax in his
subsystem, I won't argue.  In the (few) places I maintain, I'll insist
on readable, concise comments.  The @sigils are welcome, repeating
obvious things and other waste of space is not.  For what it's worth,
Kevin shared this sentiment last time we discussed it.

Luiz's call, because he's the maintainer.

>>> @@ -662,7 +662,7 @@ static void check_native_list(QObject *qobj,
>>>              tmp = qlist_peek(qlist);
>>>              g_assert(tmp);
>>>              qvalue = qobject_to_qbool(tmp);
>>> -            g_assert_cmpint(qbool_get_int(qvalue), ==, (i % 3 == 0) ? 1 : 0);
>>> +            g_assert_cmpint(qbool_get_bool(qvalue), ==, i % 3 == 0);
>>>              qobject_decref(qlist_pop(qlist));
>>>          }
>>>          break;
>> [snip]
>> 
>> I notice that we're inconsistent in using g_assert() vs.
>> g_assert_cmpint(). Given that GLib has a weird GBoolean, should we add a
>> macro qtest_assert_cmpbool() instead as follow-up?
>
> We aren't even touching GBoolean (qbool_get_bool now returns 'bool', not
> GBoolean; and bool promotes just fine to int under C rules), so I don't
> see the point to making any further changes here.  Or are you proposing
> that the new macro would do something like 'expecting "true" but got
> "false"' instead of g_assert_cmpint() collapsing things to 0 and 1?

Promoting to int here is just fine with me.

Andreas is right on GBoolean of course.  It's a relic that has become a
trap for the unwary.  Let's stay away from it as much as we can.

  reply	other threads:[~2015-05-18  6:42 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-15 22:24 [Qemu-devel] [PATCH 0/2] Use bool for QBool Eric Blake
2015-05-15 22:24 ` [Qemu-devel] [PATCH 1/2] qobject: Use 'bool' for qbool Eric Blake
2015-05-16 13:30   ` Andreas Färber
2015-05-16 17:13     ` Eric Blake
2015-05-18  6:42       ` Markus Armbruster [this message]
2015-05-19 12:59   ` Alberto Garcia
2015-06-12  5:35   ` Markus Armbruster
2015-06-12 15:38     ` Eric Blake
2015-05-15 22:25 ` [Qemu-devel] [PATCH 2/2] qobject: Use 'bool' inside qdict Eric Blake
2015-05-19 13:00   ` Alberto Garcia
2015-05-28 19:54 ` [Qemu-devel] [PATCH 0/2] Use bool for QBool Luiz Capitulino
2015-06-11 17:53   ` Luiz Capitulino
2015-06-16 14:53 ` Markus Armbruster

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87pp5ytmho.fsf@blackfin.pond.sub.org \
    --to=armbru@redhat.com \
    --cc=afaerber@suse.de \
    --cc=berto@igalia.com \
    --cc=eblake@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=lcapitulino@redhat.com \
    --cc=mdroth@linux.vnet.ibm.com \
    --cc=mreitz@redhat.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.