How To Write Comments For Better Readility
Comments
here are types of comments:
- unifying Coding and Comment Style. By way of illustration, it is shown at the following:
//
/** */
📝 Comment: The Comment easy for laymen to understand are beautiful.
- File Comment
/**
* @file test.cpp
* @author your name (you@domain.com)
* @brief
* @version 0.1
* @date 2023-08-08
*
* @copyright Copyright (c) 2023
*
*/
#include `<iostream>`
- Clsss Comment
/**
* @brief
*
* @tparam T
*/
template `<class T>`
class LinkedList: List{
private:
LinkedNode *node;
public:
LinkedList(){};
~LinkedList(){};
void operator()(const T* arg){
}
}
- Function Comment
/**
* @brief
*
* @param arg_1
* @param arg_2
* @return T
*/
T test::functionName(T arg_1,T arg_2){
}
- Process Comment
void diffcult(int i,...){
...
va_list args;//brief...
va_start(args,i);//brief...
va_end(args);//brief...
...
}
- Variable Comment
ListNode * cursor //the cursor for search
💡 Tip: Remember to appreciate the little things in life.
Credit:Google 开源项目风格指南