C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Standardizing Code Documentation

From: Jan Schultke <janschultke_at_[hidden]>
Date: Tue, 24 Jun 2025 13:57:00 +0200
I've had a very similar idea a while back, although I'm not sure if
I've floated it on this mailing list.

The overall take was that such a documentation tool doesn't need to be
in the C++ standard itself. There may be value in having a separate
standard which describes the syntax for doc comments also maintained
through the ISO process, but that's as far as makes sense to
standardize.

The hard part which is worth standardizing is which specifications
(@param etc.) exist, what their syntax is, and how they link to C++
constructs in the declarations below. While Doxygen has established
itself as sort of a standard, we would really want all tooling to have
some common, rigorously specified documentation language that's some
subset of the Doxygen syntax, so that you can rely on certain parts
working with every linter and other tool that interacts with doc
comments.

There is very little motivation for this to live in the C++ standard
directly though, or to have a syntax based on attributes. Doc comments
seem like a perfect fit for this task. Keep in mind that WG21
standardizes existing practice if possible, and designing some
attribute syntax for documentation out of thin air seems like a bad
fit for standardization.

If you want attributes to do this, feel free to implement such doc
attributes in a compiler or documentation generator, let that feature
mature for ten years, and then come back with experience and existing
practice.

Received on 2025-06-24 11:57:15