Let's say I want to show a /* - */ delimited comment block inside a code block in a
Doxygen documentation block in C++ code. If the Doxygen block, is itself /* - */
delimited, like this,
/**
documentation
\code
/*
comment
*/
\endcode
*/
that's clearly going to be a problem: Doxygen will do the right thing, but a C++ compiler
won't know that it should ignore the inner */. An alternative is to use a
///-delimited Doxygen block:
/// documentation
/// \code
/// /*
/// comment
/// */
/// \endcode
This version won't confuse the C++ compiler, but now Doxygen adds an extra star. How can I make both Doxygen and C++ happy?
It was suggested in comments that I could at least align the extra asterisk with the ones that are supposed to be there, making the output look better. In some cases that might be acceptable, but I think that would be a problem for me, so let me explain why. The documentation is discussing a renderer shading language that understands #include and single-line comments but not block comments, and wants to say:
Block comment lines are not supported, but may not matter if the included file does not close the block:
/* #include "MyFile.h" --> file will be included anyway. */
If that gets changed to
/* * #include "MyFile.h" --> file will be included anyway. */
then it may look fine, but I don't know if it will be semantically correct any more, because I don't know what that extra asterisk would do.

