假设我想在C++代码的Doxygen文档块中展示一个/* - */
分隔的注释块。如果Doxygen块本身是/* - */
分隔的,就像这样:
/**
documentation
\code
/*
comment
*/
\endcode
*/
那显然会成为一个问题:Doxygen会做正确的事情,但C++编译器不知道它应该忽略内部的*/
。另一种选择是使用以///
为分隔符的Doxygen块:
/// documentation
/// \code
/// /*
/// comment
/// */
/// \endcode
这个版本不会让C++编译器混淆,但现在Doxygen多了一个星号。我怎样才能让Doxygen和C++都满意?
评论中建议我至少将多余的星号与应该存在的星号对齐,使输出看起来更好。在某些情况下可能是可以接受的,但我认为这对我来说会是一个问题,所以让我解释一下原因。文档正在讨论一种渲染器着色语言,它理解#include
和单行注释,但不理解块注释,并想要表达:
如果那个被改变为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. */
/* * #include "MyFile.h" --> file will be included anyway. */
那么它可能看起来不错,但我不确定它是否仍然具有语义正确性,因为我不知道那个额外的星号会做什么。
///
版本中自己添加*
。 - albert/// * comment
时,结果将对齐整齐。 - albertMULTILINE_CPP_IS_BRIEF=YES
可以帮助您(这对所提出的小案例有效)。 - albert