一 Javadoc style
/**
* @brief this is a javadoc style comment1.
*/
/**
@brief this is a javadoc style comment2.
*/
/** @brief this is a javadoc style comment3.*/
class JavaDocStyle{
};
Javadoc风格最主要的特征是开始的两个*;单行多行均可,例如上面的comment1和commen3;中间的*可以省略,例如上面的comment2.
二 Qt style
/*!
* @brief this is a Qt style comment.
*/
class QtStyle{
};
区别是两个*换成了*!。
三 third style
///
/// @brief this is a third style comment1.
///
//!
//! @brief this is a third style comment2.
//!
class ThirdStyle{
};
不同风格可以混合使用,但从清晰度考虑,不推荐。
四 html效果

五 参考
本文详细介绍了三种不同的代码注释风格:Javadoc风格、Qt风格和第三种自定义风格,对比了它们的特点与用法,为程序员提供了选择合适注释方式的指导。
1301

被折叠的 条评论
为什么被折叠?



