All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eduardo Habkost <ehabkost@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
	"Marc-André Lureau" <marcandre.lureau@gmail.com>,
	"Daniel P. Berrangé" <berrange@redhat.com>,
	QEMU <qemu-devel@nongnu.org>
Subject: Re: [PATCH v2 3/8] qnum: QNumValue type for QNum value literals
Date: Wed, 25 Nov 2020 10:01:07 -0500	[thread overview]
Message-ID: <20201125150107.GD2271382@habkost.net> (raw)
In-Reply-To: <87y2iqaqhb.fsf@dusky.pond.sub.org>

On Wed, Nov 25, 2020 at 07:40:48AM +0100, Markus Armbruster wrote:
> Eduardo Habkost <ehabkost@redhat.com> writes:
> 
> > On Tue, Nov 24, 2020 at 04:20:37PM +0100, Markus Armbruster wrote:
> >> Eduardo Habkost <ehabkost@redhat.com> writes:
> >> 
> >> > On Tue, Nov 24, 2020 at 09:49:30AM +0100, Markus Armbruster wrote:
> >> >> Eduardo Habkost <ehabkost@redhat.com> writes:
> >> >> 
> >> >> > On Mon, Nov 23, 2020 at 08:51:27AM +0100, Markus Armbruster wrote:
> >> >> >> Eduardo Habkost <ehabkost@redhat.com> writes:
> >> >> >> 
> >> >> >> > On Fri, Nov 20, 2020 at 06:29:16AM +0100, Markus Armbruster wrote:
> >> >> >> [...]
> >> >> >> >> When the structure of a data type is to be kept away from its users, I
> >> >> >> >> prefer to keep it out of the public header, so the compiler enforces the
> >> >> >> >> encapsulation.
> >> >> >> >
> >> >> >> > I prefer that too, except that it is impossible when users of the
> >> >> >> > API need the compiler to know the struct size.
> >> >> >> 
> >> >> >> There are cases where the structure of a data type should be
> >> >> >> encapsulated, yet its size must be made known for performance (avoid
> >> >> >> dynamic memory allocation and pointer chasing).
> >> >> >> 
> >> >> >> Need for encapsulation correlates with complex algorithms and data
> >> >> >> structures.  The cost of dynamic allocation is often in the noise then.
> >> >> >
> >> >> > I don't know what we are talking about anymore.  None of this
> >> >> > applies to the QNum API, right?
> >> >> >
> >> >> > QNum/QNumValue are not complex data structures, and the reason we
> >> >> > need the compiler to know the size of QNumValue is not related to
> >> >> > performance at all.
> >> >> 
> >> >> We started with the question whether to make QNumValue's members
> >> >> private.  We digressed to the question when to make members private.
> >> >> So back to the original question.
> >> >> 
> >> >> > We might still want to discourage users of the QNum API from
> >> >> > accessing QNum.u/QNumValue.u directly.  Documenting the field as
> >> >> > private is a very easy way to do it.
> >> >> 
> >> >> It's a complete non-issue.  QNum has been around for years, and we
> >> >> haven't had any issues that could've been plausibly avoided by asking
> >> >> people to refrain from accessing its members.
> >> >> 
> >> >> If there was an actual need to keep the members private, I'd move the
> >> >> struct out of the header, so the compiler enforces privacy.
> >> >
> >> > Understood.  There's still a question I'd like to answer, to
> >> > decide how the API documentation should look like:
> >> >
> >> >   Is QNum.u/QNumValue.u required to be part of the API
> >> >   documentation?
> >> >
> >> > If accessing that field directly is not necessary for using the
> >> > API, I don't think it should appear in the documentation (because
> >> > it would be just noise).
> >> 
> >> The current patch's comment on QNumValue looks good to me.
> >> 
> >> Does this answer your question?
> >
> > The current patch (v3) doesn't address the question.  It doesn't
> > include documentation for the field, but doesn't hide it.
> > kernel-doc will print a warning on that case.
> 
> Do we care?

Yes.  Peter will reject pull requests if it generates kernel-doc
warnings.

> How many such warnings exist before the patch?

Zero.

> Does this series add just this one, or more?

The current series (v3) doesn't add any, because I dropped the
patch that added QObject and QNum documentation to docs/devel.  I
still want to resubmit that patch later, though.

> 
> Use your judgement, then be ready to explain it :)

OK!

-- 
Eduardo



  reply	other threads:[~2020-11-25 15:02 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-16 22:41 [PATCH v2 0/8] qom: Use qlit to represent property defaults Eduardo Habkost
2020-11-16 22:41 ` [PATCH v2 1/8] qobject: Include API docs in docs/devel/qobject.html Eduardo Habkost
2020-11-17  8:23   ` Marc-André Lureau
2020-11-19  9:37   ` Markus Armbruster
2020-11-19 18:03     ` Eduardo Habkost
2020-11-16 22:41 ` [PATCH v2 2/8] qnum: Make qnum_get_double() get const pointer Eduardo Habkost
2020-11-17  8:26   ` Marc-André Lureau
2020-11-16 22:41 ` [PATCH v2 3/8] qnum: QNumValue type for QNum value literals Eduardo Habkost
2020-11-17  8:37   ` Marc-André Lureau
2020-11-17 14:42     ` Eduardo Habkost
2020-11-17 14:58       ` Marc-André Lureau
2020-11-19 10:24         ` Markus Armbruster
2020-11-19 18:21           ` Eduardo Habkost
2020-11-19 20:55             ` Eduardo Habkost
2020-11-20  9:05               ` Markus Armbruster
2020-11-20  5:29             ` Markus Armbruster
2020-11-20 18:27               ` Eduardo Habkost
2020-11-23  7:51                 ` Markus Armbruster
2020-11-23 18:33                   ` Eduardo Habkost
2020-11-24  8:49                     ` Markus Armbruster
2020-11-24 14:41                       ` Eduardo Habkost
2020-11-24 15:20                         ` Markus Armbruster
2020-11-24 15:29                           ` Eduardo Habkost
2020-11-25  6:40                             ` Markus Armbruster
2020-11-25 15:01                               ` Eduardo Habkost [this message]
2020-11-16 22:41 ` [PATCH v2 4/8] qnum: qnum_value_is_equal() function Eduardo Habkost
2020-11-17  8:42   ` Marc-André Lureau
2020-11-17 15:49     ` Eduardo Habkost
2020-11-17 16:53       ` Marc-André Lureau
2020-11-17 17:21         ` Eduardo Habkost
2020-11-19 10:27   ` Markus Armbruster
2020-11-19 18:24     ` Eduardo Habkost
2020-11-20  6:52       ` Markus Armbruster
2020-11-20 18:22         ` Eduardo Habkost
2020-11-23  8:17           ` Markus Armbruster
2020-11-16 22:41 ` [PATCH v2 5/8] qlit: Support all types of QNums Eduardo Habkost
2020-11-17  8:52   ` Marc-André Lureau
2020-11-19 10:39     ` Markus Armbruster
2020-11-19 18:56       ` Eduardo Habkost
2020-11-20  6:55         ` Markus Armbruster
2020-11-16 22:41 ` [PATCH v2 6/8] qlit: qlit_type() function Eduardo Habkost
2020-11-17  8:53   ` Marc-André Lureau
2020-11-19 10:41   ` Markus Armbruster
2020-11-19 17:56     ` Eduardo Habkost
2020-11-16 22:41 ` [PATCH v2 7/8] qom: Make object_property_set_default() public Eduardo Habkost
2020-11-17  8:56   ` Marc-André Lureau
2020-11-16 22:41 ` [PATCH v2 8/8] qom: Use qlit to represent property defaults Eduardo Habkost
2020-11-17  9:02   ` Marc-André Lureau
2020-11-19 12:39 ` [PATCH v2 0/8] " Markus Armbruster
2020-11-19 17:13   ` Eduardo Habkost
2020-11-19 17:23     ` Paolo Bonzini
2020-11-19 17:55       ` Eduardo Habkost
2020-11-19 18:25         ` Paolo Bonzini
2020-11-19 19:05           ` Eduardo Habkost

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=20201125150107.GD2271382@habkost.net \
    --to=ehabkost@redhat.com \
    --cc=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=marcandre.lureau@gmail.com \
    --cc=pbonzini@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.