From: Markus Armbruster <armbru@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: "John Snow" <jsnow@redhat.com>, "Kevin Wolf" <kwolf@redhat.com>,
"Thomas Huth" <thuth@redhat.com>,
"patches@linaro.org" <patches@linaro.org>,
"QEMU Trivial" <qemu-trivial@nongnu.org>,
"Markus Armbruster" <armbru@redhat.com>,
"Cornelia Huck" <cohuck@redhat.com>,
"Richard Henderson" <richard.henderson@linaro.org>,
"QEMU Developers" <qemu-devel@nongnu.org>,
"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
"Alex Williamson" <alex.williamson@redhat.com>,
"Stefan Hajnoczi" <stefanha@redhat.com>,
"Richard Henderson" <rth@twiddle.net>
Subject: Re: [Qemu-trivial] [Qemu-devel] [PATCH v2] CODING_STYLE: Define our preferred form for multiline comments
Date: Fri, 15 Jun 2018 14:45:53 +0200 [thread overview]
Message-ID: <87k1r01am6.fsf@dusky.pond.sub.org> (raw)
In-Reply-To: <CAFEAcA_egToeW7ksTncbFCsW6uTh1FcPSgW6gx+VnjvQpqwWsw@mail.gmail.com> (Peter Maydell's message of "Thu, 14 Jun 2018 11:46:17 +0100")
Peter Maydell <peter.maydell@linaro.org> writes:
> On 13 June 2018 at 17:55, John Snow <jsnow@redhat.com> wrote:
[...]
>> It would only begin to matter terribly much if we actually decided we
>> wanted to do a doxygen-style doc generation for our internal APIs for
>> compatibility with, say, fancier IDEs than vim/emacs.
>
> We ought to do that at some point -- I had some prototype patches
> for it. Doc-comment comments always start /** on a line of its own,
> though.
>
>> As it stands, we're pretty inconsistent about which exact style we apply
>> when we "document" internal functions -- sometimes we document the
>> header, sometimes the implementation, sometimes both (but differently!)
>> and always with different styles all over the place. That's the real
>> problem, IMO.
>
> IMHO -- global functions should always be documented in the header
> with the prototype, and any new global function should get a
> doc comment (I require this for code I review...) I should be able
> to read about the API your code exposes to the rest of QEMU purely
> by looking at your headers.
Putting the function contract far from the actual function is a proven
way to end up with a contract that is far from what the function
actually does.
With a documentation generator such as Sphinx, the usual argument for
putting the contracts in headers "I want API documentation in one place,
without clutter" carries a lot less weight: the generated documentation
is exactly that.
WARNING: multiple messages have this Message-ID (diff)
From: Markus Armbruster <armbru@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: "John Snow" <jsnow@redhat.com>, "Kevin Wolf" <kwolf@redhat.com>,
"Thomas Huth" <thuth@redhat.com>,
"patches@linaro.org" <patches@linaro.org>,
"QEMU Trivial" <qemu-trivial@nongnu.org>,
"Markus Armbruster" <armbru@redhat.com>,
"Cornelia Huck" <cohuck@redhat.com>,
"Richard Henderson" <richard.henderson@linaro.org>,
"QEMU Developers" <qemu-devel@nongnu.org>,
"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
"Alex Williamson" <alex.williamson@redhat.com>,
"Stefan Hajnoczi" <stefanha@redhat.com>,
"Richard Henderson" <rth@twiddle.net>
Subject: Re: [Qemu-devel] [PATCH v2] CODING_STYLE: Define our preferred form for multiline comments
Date: Fri, 15 Jun 2018 14:45:53 +0200 [thread overview]
Message-ID: <87k1r01am6.fsf@dusky.pond.sub.org> (raw)
In-Reply-To: <CAFEAcA_egToeW7ksTncbFCsW6uTh1FcPSgW6gx+VnjvQpqwWsw@mail.gmail.com> (Peter Maydell's message of "Thu, 14 Jun 2018 11:46:17 +0100")
Peter Maydell <peter.maydell@linaro.org> writes:
> On 13 June 2018 at 17:55, John Snow <jsnow@redhat.com> wrote:
[...]
>> It would only begin to matter terribly much if we actually decided we
>> wanted to do a doxygen-style doc generation for our internal APIs for
>> compatibility with, say, fancier IDEs than vim/emacs.
>
> We ought to do that at some point -- I had some prototype patches
> for it. Doc-comment comments always start /** on a line of its own,
> though.
>
>> As it stands, we're pretty inconsistent about which exact style we apply
>> when we "document" internal functions -- sometimes we document the
>> header, sometimes the implementation, sometimes both (but differently!)
>> and always with different styles all over the place. That's the real
>> problem, IMO.
>
> IMHO -- global functions should always be documented in the header
> with the prototype, and any new global function should get a
> doc comment (I require this for code I review...) I should be able
> to read about the API your code exposes to the rest of QEMU purely
> by looking at your headers.
Putting the function contract far from the actual function is a proven
way to end up with a contract that is far from what the function
actually does.
With a documentation generator such as Sphinx, the usual argument for
putting the contracts in headers "I want API documentation in one place,
without clutter" carries a lot less weight: the generated documentation
is exactly that.
next prev parent reply other threads:[~2018-06-15 12:46 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-11 14:17 [Qemu-trivial] [PATCH v2] CODING_STYLE: Define our preferred form for multiline comments Peter Maydell
2018-06-11 14:17 ` [Qemu-devel] " Peter Maydell
2018-06-11 14:21 ` [Qemu-trivial] " Eric Blake
2018-06-11 14:21 ` Eric Blake
2018-06-11 14:57 ` [Qemu-trivial] " Cornelia Huck
2018-06-11 14:57 ` [Qemu-devel] " Cornelia Huck
2018-06-11 16:02 ` [Qemu-trivial] " Markus Armbruster
2018-06-11 16:02 ` Markus Armbruster
2018-06-11 16:15 ` [Qemu-trivial] " Alex Williamson
2018-06-11 16:15 ` [Qemu-devel] " Alex Williamson
2018-06-11 16:40 ` [Qemu-trivial] " Peter Maydell
2018-06-11 16:40 ` [Qemu-devel] " Peter Maydell
2018-06-11 16:49 ` [Qemu-trivial] " Alex Williamson
2018-06-11 16:49 ` [Qemu-devel] " Alex Williamson
2018-06-11 16:24 ` [Qemu-trivial] " Thomas Huth
2018-06-11 16:24 ` [Qemu-devel] " Thomas Huth
2018-06-11 16:31 ` [Qemu-trivial] " John Snow
2018-06-11 16:31 ` John Snow
2018-06-12 17:30 ` [Qemu-trivial] " Richard Henderson
2018-06-12 17:30 ` Richard Henderson
2018-06-12 17:41 ` [Qemu-trivial] " Philippe Mathieu-Daudé
2018-06-12 17:41 ` Philippe Mathieu-Daudé
2018-06-12 18:12 ` [Qemu-trivial] " Thomas Huth
2018-06-12 18:12 ` Thomas Huth
2018-06-12 18:47 ` [Qemu-trivial] " Alex Williamson
2018-06-12 18:47 ` Alex Williamson
2018-06-13 7:05 ` [Qemu-trivial] " Cornelia Huck
2018-06-13 7:05 ` Cornelia Huck
2018-06-13 12:30 ` [Qemu-trivial] " Peter Maydell
2018-06-13 12:30 ` Peter Maydell
2018-06-13 16:55 ` [Qemu-trivial] " John Snow
2018-06-13 16:55 ` John Snow
2018-06-14 10:46 ` [Qemu-trivial] " Peter Maydell
2018-06-14 10:46 ` Peter Maydell
2018-06-14 20:11 ` [Qemu-trivial] " John Snow
2018-06-14 20:11 ` John Snow
2018-06-15 2:52 ` [Qemu-trivial] " Philippe Mathieu-Daudé
2018-06-15 2:52 ` Philippe Mathieu-Daudé
2018-06-15 4:43 ` [Qemu-trivial] " Thomas Huth
2018-06-15 4:43 ` Thomas Huth
2018-06-15 8:48 ` [Qemu-trivial] " Peter Maydell
2018-06-15 8:48 ` Peter Maydell
2018-06-15 12:45 ` Markus Armbruster [this message]
2018-06-15 12:45 ` Markus Armbruster
2018-06-13 13:31 ` [Qemu-trivial] " Stefan Hajnoczi
2018-06-13 13:31 ` [Qemu-devel] " Stefan Hajnoczi
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=87k1r01am6.fsf@dusky.pond.sub.org \
--to=armbru@redhat.com \
--cc=alex.williamson@redhat.com \
--cc=cohuck@redhat.com \
--cc=f4bug@amsat.org \
--cc=jsnow@redhat.com \
--cc=kwolf@redhat.com \
--cc=patches@linaro.org \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=rth@twiddle.net \
--cc=stefanha@redhat.com \
--cc=thuth@redhat.com \
/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.