与Doxygen内联的注释变量是否会受到任何处罚?

but*_*oys 5 c++ doxygen

我看到大多数Doxygen文档用于评论c ++函数,看起来类似于

/// a description of the function or method followed with comments, like so
/// @return true=success, false=error
/// @param[in] bar blah blah
/// @param[out] baz blah blah
/// @param[out] quux blah blah
/// @param[out] quuux blah blah
/// @param[out] quuuux blah blah
static bool foo_one( int *bar, int *baz, int *quux, int *quuux, int *quuuux );
Run Code Online (Sandbox Code Playgroud)

或xml等价物(粗略)

/// a description of the function or method, followed by
/// <returns>true=success, false=error</returns>
/// <param name=bar>blah blah</param>
/// <param name=baz>blah blah</param>
/// <param name=quux>blah blah</param>
/// <param name=quuux>blah blah</param>
/// <param name=quuuux>blah blah</param>
static bool foo_two( int *bar, int *baz, int *quux, int *quuux, int *quuuux );
Run Code Online (Sandbox Code Playgroud)

但我一直在主要评论我的参数内联,就像这样

/// a description of the function or method, followed by
/// @return true=success, false=error
static bool foo_three(
    int *bar,               ///< [in]  blah blah
    int *baz,               ///< [out] blah blah
    int *quux,              ///< [out] blah blah
    int *quuux,             ///< [out] blah blah
    int *quuuux             ///< [out] blah blah
);
Run Code Online (Sandbox Code Playgroud)

所有这三个都在html文件中提供相同的输出(中间的输出除外,它没有指定输入/输出).

我的问题:是否有Doxygen,Visual Studio或任何其他环境的功能,我无法使用我的内联方法?我理解在编写和阅读代码本身的评论时有个人偏好,并且不愿讨论那些.我只是想知道是否有Doxygen或其他环境功能或格式我将会错过.

Mar*_*lff 5

是的。

Doxygen 本身可以很好地处理内联注释。

但是,还要考虑对源代码控制系统记录的历史记录的影响(例如git, 和git blame

使用内联注释,最后更改行的人是添加或更改文档的人,这使得更难找到何时/为什么更改代码本身。

注释在单独的行上,尤其是在代码之后添加文档时,检查历史以查找代码更改会更容易。

  • @MarcAlff:我更喜欢属于一起的事情也一起处理。您认为无需更改代码即可更改注释的想法将使查看代码历史变得困难,这对我来说似乎不是一个论点。也许是口味问题? (2认同)