doc: Discourage trailing doxygen comments, and fix the broken ones #34967

pull maflcko wants to merge 1 commits into bitcoin:master from maflcko:2603-doc-doxygen-trail changing 4 files +20 −16
  1. maflcko commented at 4:40 PM on March 31, 2026: member

    The trailing doxygen comments are problematic:

    • They are often wrong and need to be fixed up manually, see e.g #7793, #14331, ..., and this pull
    • Also, changing any type or name in a way that changes the max line length may require reflowing the whole struct with clang-format.
    • Also, once they become multi-line, they will read even more confusingly.

    Fix all issues by tolerating them, but favoring descriptions before the described item.

    Also, fix the broken ones.

    Example doxygen rendering: https://doxygen.bitcoincore.org/struct_private_broadcast_1_1_send_status.html (broken before this pull, fixed in this pull)

  2. DrahtBot added the label Docs on Mar 31, 2026
  3. DrahtBot commented at 4:40 PM on March 31, 2026: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK stickies-v, l0rinc

    If your review is incorrectly listed, please copy-paste <code>&lt;!--meta-tag:bot-skip--&gt;</code> into the comment that the bot should ignore.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

  4. maflcko force-pushed on Mar 31, 2026
  5. in doc/developer-notes.md:1 in fa378842fc outdated


    stickies-v commented at 1:21 PM on April 2, 2026:

    I think we should be more explicit about discouraging inline comments, and provide the rationale for it. Having two "Description before the member" examples also seems a bit unnecessary, so suggested alternative to address all of that:

    <details> <summary>git diff on fa378842fc</summary>

    diff --git a/doc/developer-notes.md b/doc/developer-notes.md
    index 820483f746..804755f49b 100644
    --- a/doc/developer-notes.md
    +++ b/doc/developer-notes.md
    @@ -225,17 +225,16 @@ To describe a class, use the same construct above the class definition:
     class CAlert
     ```
     
    -To describe a member or variable, you can use the same delimiters (`/**` and `*/`), or use a prefix of `//!`, or three slashes `///` (the styles are generally exchangeable):
    +To describe a member or variable, place the comment on the line(s) before it, using `/**` and `*/`, `//!`, or `///`:
     ```c++
     //! Description before the member
     int var;
     ```
     
    -or
    -```c++
    -/// Description before the member
    -int var;
    -```
    +Avoid trailing (inline) member comments like `int var; //!< Description after the member`.
    +
    +  - *Rationale*: Forgetting the `<` silently breaks Doxygen output, they do not
    +    support multi-line comments, and changing types or names requires reflowing.
     
     Also OK:
     ```c++
    
    

    </details>


    maflcko commented at 1:50 PM on April 2, 2026:

    Thx, done. Though, I left out the style stuff, because trailing multi-line comments are supported, they just look ugly. Also, some devs may not care about having to re-flow.

    For reference, I also don't like /** */, because devs often forget the second star (*), turning it into a code comment, not a doxygen comment. Also, they are inconsistently used (even in the same class):

    /** one */
    
    /**
     * two */
    
    /** three_a
     * three_b
     */
    
    /**
     * four
     */
    

    Though, at least they are not actively wrong, like the trailing comments, so I don't really mind too much.

  6. stickies-v commented at 1:21 PM on April 2, 2026: contributor

    Approach ACK, I think we should be a bit more explicit in developer-notes.

  7. doc: Discourage trailing doxygen comments, and fix the broken ones facaeb9c76
  8. maflcko force-pushed on Apr 2, 2026
  9. stickies-v approved
  10. stickies-v commented at 2:04 PM on April 2, 2026: contributor

    ACK facaeb9c762d29a573a9c19b3617699136b133e8

  11. l0rinc commented at 9:03 AM on April 6, 2026: contributor

    ACK facaeb9c762d29a573a9c19b3617699136b133e8

  12. fanquake merged this on Apr 6, 2026
  13. fanquake closed this on Apr 6, 2026

  14. maflcko deleted the branch on Apr 7, 2026

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-22 18:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me