2-5 Linux编程规范
来源:互联网 发布:vscode vue 开发环境 编辑:程序博客网 时间:2024/06/08 04:43
(近来用得比较多的规范框架在这里)
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;
}
- 2-5 Linux编程规范
- linux下编程规范
- Linux编程规范网址
- Linux项目组编程规范
- linux 内核编程风格规范
- LINUX内核代码编程规范
- linux内核编程风格规范
- Linux 内核 C 编程规范
- linux C编程规范心得
- linux下C编程规范
- linux应用开发-编程规范
- 服务器编程入门(5)Linux服务器程序规范
- 代码编程规范之linux下编程
- 编程规范5
- C#编程规范 2
- VC编程规范(2)
- oracle编程规范2
- 编程规范2
- TEST
- 优秀程序员的十个习惯
- 仿qq列表,分类悬停
- java调用rest风格web服务的两种方式
- thinkPHP PHPMailer 发送邮件
- 2-5 Linux编程规范
- linux上如何查看当前有多少人使用服务器的vpn或ssh服务?
- jq实现简单的tab切换效果
- 结构性伪类选择器—empty
- [3]数据库多表连接查询
- TCP、UDP、HTTP、SOCKET之间的区别
- 201512-1 数位之和
- iOS 单独集成qq和微信分享sdk的方法
- Layout(最短路)