c语言函数简单注释模板,C语言中的Doxygen注释模板

目录一、文件注释,放于文件的开头

二、函数注释,放于函数声明前

三、数据结构注释,放于数据结构定义前

四、宏定义注释,放于宏定义上方或者右侧

五、 全局和静态变量注释

六、常用标签命令关键字

嵌入式C语言开发中通常使用Doxygen进行文档的生成。Doxygen支持多种格式,非常灵活,但排版不好就会显的比较杂乱,不便于阅读。下面给出一份注释模板。

一、文件注释,放于文件的开头

/**

* @file

* @briefThis is a brief description.

* @details This is the detail description.

* @authorauthor

* @date date

* @version v1.0

* @par Copyright(c): abc corporation

* @par History:

*version: author, date, desc\n

*/

@file 后面貌似不能加文件名,否则不能识别文件头;Doxygen生成示意图:

9fbdd7db5ce6f484ad65dee40b61d3e7.png

二、函数注释,放于函数声明前

/**

/**

* This is a brief description.

* This is a detail description.

* @param[in]inArgName input argument description.

* @param[out]outArgName output argument description.

* @retvalOK成功

* @retvalERROR错误

* @par 标识符

* 保留

* @par 其它

* 无

* @par 修改日志

* XXX于2020-07-06创建

*/

int cstyle( int inArgName, int outArgName);

Doxygen生成示意图:

73fb99e6e9d3afe140a2f153ead41e8d.png

三、数据结构注释,放于数据结构定义前

/**

* @briefThis is a brief description.

* @details This is the detail description.

*/

typedef struct

{

int var1; /*!< Detailed description of the member var1 */

int var2; /*!< Detailed description of the member var2*/

int var3; /*!< Detailed description of the member var3 */

} abc;

Doxygen生成示意图:

9b019cbef56c11879c0a29bb5983a07e.png

四、宏定义注释,放于宏定义上方或者右侧

/** Description of the macro a */

#define a0

#define b0/*!< Description of the macro b */

Doxygen生成示意图:

c926bdd19955e6acb2d60909bdcd3818.png

五、 全局和静态变量注释

/** Description of global variable */

int g_qwe = 0;

int static s_asd = 0; /*!< Description of static variable */

Doxygen生成示意图:

5bf6bfc45ef4e4e52ce2a6af9a703553.png

六、常用标签命令关键字

文件信息:

1) @file --> 文件声明,即当前文件名

2) @author --> 作者

3) @version --> 版本,

4) @todo --> 改进,可以指定针对的版本

模块信息:

1) @var --> 模块变量说明

2) @typedef --> 模块变量类型说明

函数信息:

1) @param --> 参数说明

2) @arg --> 列表说明参数信息

3) @return --> 返回值说明

4) @retval --> 返回值类型说明

5) @note --> 注解

提醒信息:

1) @brief --> 摘要,即当前文件说明

2) @see --> 参看

3) @attention --> 注意

4) @bug --> 问题

5) @warning --> 警告

6) @sa --> 参考资料

  • 1
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值