Post

代码命名规范

代码命名规范

原文地址:https://www.lucien.ink/archives/424/

只是我个人决定用这种写法,仅供参考,欢迎提建议。

对象名

常量

1
2
const std::string BLOG_ADDR = "https://lucien.ink";
const int MAX_LENGTH = 200;

变量

小驼峰式命名法

1
2
int maxCount = 10;
std::string tableTitle = "LoginTable";

全局变量

g + 变量名

1
int gMax = int(1e9) + 7;

私有变量

双下划线 + 变量名

1
std::string __name = "Lucien Shui";

函数名

待填坑

This post is licensed under CC BY 4.0 by the author.