I think the current standard specifies full well, what parts of the translation unit is a comment and which parts are the actual code.
So you could e.g. deduce a tool from the standard, which inserts two markers: Comment start, comment stop.
Could Siddharth and you, Simon, elaborate, what you want to get beyond this distinction?
- A better guarantee that current comments are not used as code in future C++ versions? I think that the standard progression is quite conservative in this regards to make sure not to change the meaning of existing programs
- A better connection of comments to actual C++ entities?
- The tooling itself, but the standard is fine for specifying?
- Output of the code structure / parse tree? And the comments on top of it?
- Something else?
-----Ursprüngliche Nachricht-----
Von: Simon Schröder via Std-Proposals <std-proposals@lists.isocpp.org>
Gesendet: Di 24.06.2025 12:47
Betreff: Re: [std-proposals] Standardizing Code Documentation
An: std-proposals@lists.isocpp.org;
CC: Simon Schröder <dr.simon.schroeder@gmail.com>;
I believe that it would be a good part if C++ would handle PARSING for documentation. A [[doc]] attribute would be much better than regular comments (which could be documentation or just plain comments). Parsing C++ is the hard part and it constantly changes with each new standard. Why would e.g. Doxygen constantly have to change their parser to understand the most current C++? Should I wait to adopt new C++ features until they can also be parsed by the documentation tool?I would say, we don't need to specify the syntax of the documentation, but if the compiler can extract these, it would be really nice. It could output the documentation to e.g. json to have a connection between the documentation text and the function signature, the class name, or whatever. Parsing JSON would be a lot easier for Doxygen and it would not have to adapt to any new C++ standard (at least most of the time).On Tue, Jun 24, 2025 at 12:25 PM Tiago Freire via Std-Proposals <std-proposals@lists.isocpp.org> wrote:--As it has been pointed.Doxygen has become an informal standard that sees a wide support in IDEs. And I would rather that such a thing not be made part of the C++ standard.You don't need the C++ to standard to make any normative statements on this in order to work, you can have a standard that works in parallel.Let C++ just be normative regarding how text is interpreted to generate code, for documentation generation let something else do that work.
Std-Proposals mailing list
Std-Proposals@lists.isocpp.org
https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
-- Std-Proposals mailing list Std-Proposals@lists.isocpp.org https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals