Chinaunix首页 | 论坛 | 博客
  • 博客访问: 253668
  • 博文数量: 65
  • 博客积分: 2599
  • 博客等级: 少校
  • 技术积分: 710
  • 用 户 组: 普通用户
  • 注册时间: 2010-05-04 10:49
文章分类

全部博文(65)

文章存档

2015年(4)

2013年(2)

2012年(4)

2011年(51)

2010年(4)

分类: LINUX

2011-11-17 17:50:11

1. 注释例子
1.1 注释一个宏

/**
  @def MAX(x,y)
  Computes the maximum of \a x and \a y.
*/
#define MAX(x,y) ((x)>(y)?(x):(y))
或者:
/**
   Computes the absolute value of its argument \a x.
*/
#define ABS(x) (((x)>0)?(x):-(x))

其中:
    @a:表示引用的是一个变量,会用斜体字显示.

1.2 注释一个枚举
/**
 * @enum my_enum
 * enum for test.
 */
enum my_enum {
    var1,   /**< first. */
    var2,   /**< second. */
    var3    /**< third. */
};

1.3 注释一个union
/**
 * @union my_union
 * This union is used for xxxx.
 */
union my_union {
    int choice1;            /**< first desc */
    unsigned long choice2;  /**< second desc */
    unsigned char *choice3; /**< third desc */
};

1.4 注释一个结构体
/**
 * @struct my_struct
 * This struct used for xxxx.
 */
struct my_struct {
    int a;              /**< first */
    enum my_enum b;     /**< second. @see enum my_enum */
    union my_union c;   /**< third. @see union my_union */

};

1.5 注释一个类型定义
/**
 * @typedef my_type
 * This type is used for xxxx.
 */
typedef unsigned long long int my_type;

1.6 注释一个函数
/** @fn int print_sth(int times, struct my_struct *ms)
 *  @brief print function.
 *  @details
 *      print function for struct my_struct.
 *      @see struct my_struct
 *  @param times print times.
 *  @param ms info source.
 *  @note note information.
 *  @warning warning information.
 *  @return -1 on fail while 0 on success.
 */

1.7 注释文件头
/**
 * @file      file name
 * @version   1.0.0
 * @date      2011-10-10
 * @author    Shulong Li
 * @brief
 *      This is brief,
 *      Yes a brief description.
 * @details
 *      This is detail,
 *      Yes a detailed description.
 * @bug
 *      Known bugs.
 * @warning
 *      warning information
 * @copyright
 *      GNU Public License.
 */

阅读(2496) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~