git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] strvec: use correct member name in comments

From
Jeff King <peff@peff.net>
Date
Jan 13, 2024, 07:31 UTC
Message-ID
<20240113073131.GA657764@coredump.intra.peff.net>
In-Reply-To
<owlyle8uhxut.fsf@fine.c.googlers.com>
On Fri, Jan 12, 2024 at 04:37:46PM -0800, Linus Arver wrote:
Show 8 quoted lines
> OTOH if we were treating these .h files as something meant for direct
> external consumption (that is, if strvec.h is libified and external
> users outside of Git are expected to use it directly as their first
> point of documentation), at that point it might make sense to name the
> parameters (akin to the style of manpages for syscalls). But I imagine
> at that point we would have some other means of developer docs (beyond
> raw header files) for libified parts of Git, so even in that case it's
> probably fine to keep things as is.

I think this is mostly orthogonal to libification. Whether the audience is other parts of Git or users outside of Git, they need to know how to call the function. Our main source of documentation there is comments above the declaration (we've marked these with "/**" which would allow a parser to pull them into a separate doc file, but AFAIK in the 9 years since we started that convention, nobody has bothered to write such a script).

Naming the parameters can help when writing those comments, because you can then refer to them (e.g., see the comment above strbuf_addftime). Even without that, I think they can be helpful, but I don't think I'd bother adding them in unless taking a pass over the whole file, looking for comments that do not sufficiently explain their matching functions.

I don't doubt that some of that would be necessary for libification, just to increase the quality of the documentation. But I think it's largely separate from the patch in this thread.

-Peff
Previous: Linus ArverNext: Linus Arver
Message 6 of 7 in “strvec: use correct member name in comments”
  1. strvec: use correct member name in commentsLinus Arver via GitGitGadget, Jan 12, 2024
  2. Jeff KingJan 12, 2024
  3. Linus ArverJan 12, 2024
  4. Junio C HamanoJan 12, 2024
  5. Linus ArverJan 13, 2024
  6. Jeff KingJan 13, 2024
  7. Linus ArverJan 14, 2024

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.