【问题标题】:With doxygen, when should the comments be placed before the entity, and when after?使用 doxygen,什么时候应该将注释放在实体之前,什么时候放在实体之后?
【发布时间】:2022-11-27 23:08:13
【问题描述】:

这里有两种对实体进行评论的方式(例如,在类似 C/C++ 的语言中)。

款式一:

// This is a comment
// about foo
int foo;

// This is a comment
// about bar
int bar;

样式 2:

int foo;
    // This is a comment
    // about foo

int bar;
    // This is a comment
    // about bar

我知道,通常,在编写 doxygen 注释时,它通常出现在记录的实体之前,例如:

/// This is a doxygen comment
/// about foo
int foo;

/// This is a doxygen comment
/// about bar
int bar;

情况总是如此,还是我可以将它放在实体之后,就像上面的第二种评论风格一样?

【问题讨论】:

    标签: c++ comments doxygen cross-language


    【解决方案1】:

    是的,您可以将 doxygen cmets 放在评论项之后,但在这种情况下,您必须在评论中添加特殊标记。这在Doxygen documentation中有解释:

    将文档放在成员之后

    如果你想记录文件、结构、联合、类的成员, 或枚举,有时需要放置文档块 在成员之后而不是之前。为此,你必须把 评论块中的附加 < 标记。请注意,这也有效 对于函数的参数。

    这里有些例子:

    int var; /*!< Detailed description after the member */
    

    此块可用于放置 Qt 样式的详细文档块 会员后。其他做同样事情的方法是: ...

    int var; ///< Detailed description after the member
             ///<
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-06-03
      • 1970-01-01
      • 2018-11-10
      • 1970-01-01
      • 2016-08-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多