You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

关于C++注释中@符号用作标识的命名规范咨询

C++注释中@符号标识的惯例说明
  • 这种带@brief、@return的注释格式并非C++官方标准的通用编程惯例,它属于Doxygen风格的文档注释规范。
  • Doxygen是一款主流的代码文档生成工具,通过这类@开头的特殊标记,它能自动将注释转换为结构化的API文档(比如HTML、PDF格式)。
  • 实际开发中,不少团队会采用Doxygen风格注释来统一代码文档标准,但这不是所有C++项目都遵循的规则——有些团队可能用其他工具的标记(比如Qt的/*! \brief ... */格式),或者仅用普通注释说明,完全不使用这类结构化标记。
  • VS Code教程里使用这种格式,主要是因为编辑器对Doxygen标记有原生支持,能提供代码提示、文档预览等功能,方便初学者理解代码结构和文档规范。

示例代码:

#include <iostream>
#include <vector>
#include <string>

using namespace std;

/**
* @brief An example program. This program demonstrates simple vector storage and element iteration.
*        A welcome string is output to the user.
*
* @return Returns 0 when execution completes succesfully.
*/

int main() {
   ...
}

内容的提问来源于stack exchange,提问作者ranemirusG

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.28 11:12:43