(近来用得比较多的规范框架在这里)
1. 文件头,如
/**************************************
* 文件名: addr.c *
* 创建者: xyz *
* 创建时间:20150606 *
* 程序说明:打印变量地址 *
**************************************/
2. 函数头,如
/**************************************
* 函数名: add *
* 参数: int a, int b *
* 输入: int a, int b *
* 返回: int c *
* 函数功能: 执行加法运算 *
**************************************/
3. 一些该注意的地方:
3.1 加注释时,应使用/* ............. */ ,而尽量避免使用 //.........
3.2 注意缩进,使用4个空格,而避免直接使用tab键
3.3 括号必须对齐(当然,不对齐的话,编辑器一般会有提示)
4. 最近比较常用的注释框架:
4.1 HeadFileDescription
/**************************************************************************************************
* Header File
*
* File Name : FN_FileName.c/ FN_FileName.h
* Copyright : 2016 ~ 2020 Elvin Corporation, All rights Reserved.
* Module Name : Display
*
* CPU : X86
* RTOS : windows7 32bit
*
* Create Date : 2016/04/21
* Author/Corporation : Elvin/ESYS Company
*
* Abstract Description : some function about seqlist.
*
*------------------------Revision History------------------------------------------------
* No Version Date Revised By Item Description
* 1 0.02 2016/04/21 Elvin Seqlist Just a test
**************************************************************************************************/
/**************************************************************************************************
* Muti-Include-Prevent Section
**************************************************************************************************/
#ifndef _FN_FILENAME_H
#define _FN_FILENAME_H
/**************************************************************************************************
* Debug switch Section
**************************************************************************************************/
#define D_FILENAME_BASE
/**************************************************************************************************
* Include File Section
**************************************************************************************************/
/* Perhaps there are some file will be Included */
/* No file will be Included */
#include "IncFile.h"
/**************************************************************************************************
* Macro Define Section
**************************************************************************************************/
/* Perhaps there are some Macro will be defined */
/* No Macro will be defined */
#define MAX_TIMER_OUT
/**************************************************************************************************
* Struct Define Section
**************************************************************************************************/
/* Perhaps there are some Struct be defined */
/* No Struct will be defined */
typedef struct Seqlist
{
int capacity;
int length;
}Seqlist_st, * Seqlist_pst;
/**************************************************************************************************
* Protoryppe Declare Section
**************************************************************************************************/
Seqlist_pst SeqlistCreate(int capacity);
#endif
4.2 SourceFileDescription
/**************************************************************************************************
* Source File
*
* File Name : FN_FileName.c
* Copyright : 2016 ~ 2020 Elvin Corporation, All rights Reserved.
* Module Name : Display
*
* CPU : X86
* RTOS : windows7 32bit
*
* Create Date : 2016/04/21
* Author/Corporation : Elvin/ESYS Company
*
* Abstract Description : some function about seqlist.
*
*------------------------Revision History------------------------------------------------
* No Version Date Revised By Item Description
* 1 0.02 2016/04/21 Elvin Seqlist Just a test
**************************************************************************************************/
/**************************************************************************************************
* Debug switch Section
**************************************************************************************************/
#define D_FILENAME_BASE
/**************************************************************************************************
* Include File Section
**************************************************************************************************/
/* Perhaps there are some file will be Included */
/* No file will be Included */
#include "IncFile.h"
/**************************************************************************************************
* Macro Define Section
**************************************************************************************************/
/* Perhaps there are some Macro will be defined */
/* No Macro will be defined */
#define MAX_TIMER_OUT
/**************************************************************************************************
* Struct Define Section
**************************************************************************************************/
/* Perhaps there are some Struct be defined */
/* No Struct will be defined */
typedef struct Seqlist
{
int capacity;
int length;
}Seqlist_st, * Seqlist_pst;
/**************************************************************************************************
* Prototype Declare Section
**************************************************************************************************/
Seqlist_pst SeqlistCreate(int capacity);
/**************************************************************************************************
* Global Variable Declare Section
**************************************************************************************************/
/* Perhaps there are some Global Variable be defined */
/* No Global Variable will be defined */
extern unsigned int SeqlistNode;
/**************************************************************************************************
* File Static Variable Declare Section
**************************************************************************************************/
/* Perhaps there are some Static Variable be defined */
/* No Static Variable will be defined */
static unsigned int SeqlistStatus;
/**************************************************************************************************
* Function Declare Section
**************************************************************************************************/
Seqlist_pst SeqlistCreate(int capacity)
{
Seqlist_pst slist = NULL;
return slist;
}