|
Uni20
Asynchronous tensor and runtime library.
|
This document defines the conventions for Doxygen-style documentation across the Uni20 C++ library. The goal is useful generated documentation and clear developer-facing comments, not mechanical comment coverage.
/// for ordinary declaration documentation./** ... */ for file-level overviews, module/group definitions, and long multi-paragraph or LaTeX-heavy blocks.// comments for implementation details that should not appear in generated API docs.When a description line wraps, align continuation text under the previous text:
Document new or substantially changed declarations when they are part of a developer-facing API, encode a cross-module contract, or carry important semantic, lifetime, ownership, concurrency, or mathematical invariants.
Internal helpers do not need Doxygen by default. Add Doxygen only when generated docs would help, or when the helper is a conceptual interface in practice. Use ordinary // comments for local implementation notes.
Do not add placeholder documentation such as [TODO] Document this function. If no useful comment can be written from the local context, leave the code undocumented and keep the task focused.
New or substantially edited public API Doxygen blocks should start with a concise \brief. Use additional tags when they add useful information:
\details for multi-sentence behavior or mathematical context.\pre and \post for observable requirements and guarantees.\throws for meaningful exception behavior.\note for ownership, lifetime, evaluation, or implementation context.\warning for hazards such as aliasing, races, invalid lifetimes, or undefined behavior.\tparam, \param, and \return when a template parameter, parameter, or return value has non-obvious semantics or constraints.Avoid tautological tags:
When several tags appear, use this order:
Only use \return for callable entities that actually return a value. Do not add it to classes, structs, aliases, concepts, variables, constructors, or destructors.
Define groups at module or file boundaries:
Use \ingroup sparingly. Add it where it improves generated navigation, not on every declaration. Do not repeat \ingroup on members, nested types, or declarations already covered by surrounding file or type documentation.
Namespaces such as uni20::internal, detail, and directories named internal or detail already signal internal scope. Use \internal ... \endinternal only when generated documentation needs an explicit hidden or internal section.
A small declaration may need only a brief:
A cross-module or lifetime-sensitive API should be more explicit:
Keep Markdown headings as plain text. Do not use inline-code backticks in headings: Doxygen serializes those code spans as escaped <tt>...</tt> text in generated HTML headings and page anchors. Use plain names such as DebugScheduler in headings, and keep inline code styling for body text, tables, and examples.
When a link is intended to navigate to a repository directory whose index is README.md, link to the directory, for example [Async](../async/README.md), rather than directly to ../async/README.md. GitHub then shows the directory listing before its README. scripts/doxygen-markdown-filter.py resolves these directory links to the corresponding README pages while generating the flat Doxygen site. Direct README links remain appropriate when a fragment identifies a specific section.
Validate the Markdown hierarchy, local links, subsystem indexes, explicit repository-root references, and source and example directory README navigation before generating the API site:
For documentation builds, use an out-of-source build directory:
Fix real Doxygen warnings such as a \param whose name is not in the function signature. Do not add broad documentation churn simply to satisfy a coverage metric.
| Category | Guidance |
|---|---|
| Comment style | Prefer ///; use block comments for file/module overviews |
| Briefs | Use concise \brief on new or edited public API docs |
| Parameter tags | Add when semantics or constraints are useful |
| Return tags | Add for meaningful non-void return values |
| Grouping | Use \ingroup sparingly |
| Internal helpers | Document only when it adds useful context |
| Implementation comments | Use //, not Doxygen |
| Churn | Avoid placeholder comments and mechanical tag insertion |