日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

《C语言深度解剖》中的.c/.h 程序模板及函数注释风格

發布時間:2023/12/10 编程问答 29 豆豆
生活随笔 收集整理的這篇文章主要介紹了 《C语言深度解剖》中的.c/.h 程序模板及函数注释风格 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

編程規范和變量命令規范對于代碼的可閱讀性、可維護性有著很大的影響。編程規范有很多,大公司也會制定自己公司的編程規范,如《華為技術有限公司c語言編程規范》等。對于個人編程來說沒必要將自己編寫的代碼按照每一種編程規范去規范,因為不同的?規范中可能會有相互沖突的地方。個人可以選擇編寫的代碼閱讀起來比較舒服的規范,并一直堅持使用,如此則可以形成自己的編程風格(重點不在于你知道多少種規范的,而是要在實際編程中去使用它,不必拘泥于某一種規范,可以綜合幾個規范選擇適合自己的部分堅持使用)。

這里我使用的是陳正沖老師《C語言深度解剖》中的編程規范,并根據自己的實際使用做了些改動,具體如下。

頭文件模板

/******************************************* * File Name : FN_FileName.h * CopyRight : All Rights Reserved. * Module Name : * * CPU : STM32F103C8T6 * RTOS : RT-THREAD * * Creat Date : 2020/09/17 * Author/Corporation : Jason/DJI * * Abstract Description: * * --------------Revision History---------------- * NO Version Date Revised by Description * 1 V0.0 2020/09/17 Jason the first verison * *******************************************//******************************************* * Multi-Include-Prevent Section *******************************************/ #ifndef __FN_FILENAME_H #define __FN_FILENAME_H /******************************************* * Debug switch Section *******************************************//******************************************* * Include File Section *******************************************//******************************************* * Macro Define Section *******************************************//******************************************* * Struct Define Section *******************************************//******************************************* * Prototype Declare Section *******************************************/#endif

源文件模板

/******************************************* * File Name : FN_FileName.c * CopyRight : All Rights Reserved. * Module Name : * * CPU : STM32F103C8T6 * RTOS : RT-THREAD * * Creat Date : 2020/09/17 * Author/Corporation : Jason/DJI * * Abstract Description: * * --------------Revision History---------------- * NO Version Date Revised by Description * 1 V0.0 2020/09/17 Jason the first verison * *******************************************//******************************************* * Debug switch Section *******************************************//******************************************* * Include File Section *******************************************//******************************************* * Macro Define Section *******************************************//******************************************* * Struct Define Section *******************************************//******************************************* * Prototype Declare Section *******************************************//******************************************* * Global Variable Declare Section *******************************************//******************************************* * File Static Variable Define Section *******************************************//******************************************* * Function Define Section *******************************************/

函數注釋模板

/******************************************* * Function Name : delay_us * Creat Date : 2020/09/17 * Author/Corporation : Jason/DJI * Description : uS levels of delay, use static define delay_us() means this funtion is only used in this file * Para : nus: the uS delay time * Return Code : null ------------------------------ * Revision History * Date Revised by Description * 2020/09/17 Jason the first verison *******************************************/ static void delay_us(uint16_t nus) { }/******************************************* * Function Name : Get_ADS1115_Volt * Creat Date : 2020/09/17 * Author/Corporation : Jason/DJI * Description : get ADC convert result from ADS115 * Para : channel: ADS1115 channel wants to readtimes: read how many times * Return Code : volt: the average of several results, unit is mV ------------------------------ * Revision History * Date Revised by Description * 2020/09/17 Jason the first verison *******************************************/ int16_t Get_ADS1115_Volt(enum ADS1115_Channel channel, int16_t times) { }

?

總結

以上是生活随笔為你收集整理的《C语言深度解剖》中的.c/.h 程序模板及函数注释风格的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。