Received: from eggs.gnu.org ([2001:4830:134:3::10]:36499) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fTo7D-0006Ku-1u for qemu-devel@nongnu.org; Fri, 15 Jun 2018 08:46:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fTo78-0004SJ-8i for qemu-devel@nongnu.org; Fri, 15 Jun 2018 08:46:07 -0400 From: Markus Armbruster References: <20180611141716.3813-1-peter.maydell@linaro.org> <650048df-f4b1-b351-f877-be8c84197ba2@linaro.org> Date: Fri, 15 Jun 2018 14:45:53 +0200 In-Reply-To: (Peter Maydell's message of "Thu, 14 Jun 2018 11:46:17 +0100") Message-ID: <87k1r01am6.fsf@dusky.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH v2] CODING_STYLE: Define our preferred form for multiline comments List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: John Snow , Kevin Wolf , Thomas Huth , "patches@linaro.org" , QEMU Trivial , Markus Armbruster , Cornelia Huck , Richard Henderson , QEMU Developers , Philippe =?utf-8?Q?Mathieu-Daud=C3=A9?= , Alex Williamson , Stefan Hajnoczi , Richard Henderson Peter Maydell writes: > On 13 June 2018 at 17:55, John Snow 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.