Skip to content
This repository was archived by the owner on Dec 20, 2020. It is now read-only.
This repository was archived by the owner on Dec 20, 2020. It is now read-only.

命名规范 #3

Description

@mayf3

参照google命名约定:http://zh-google-styleguide.readthedocs.org/en/latest/google-cpp-styleguide/naming/

原则:
1.变量命名要能代表变量含义,不要用单个字母,不要缩写
2.尽量不要用全局变量
3.可变通,但要说明清楚

要求:
1.文件名:全部小写字母,下划线连接,例如create_table.sql
2.类和结构体:每个单词首字母均大写,不加下划线,例如IndexController
3.普通变量:全部小写字母,下划线连接
4.全局变量:类似普通变量,前面加g_,例如g_global_number
5.类内部变量:类似普通变量,后面加_,例如total_number_(ps:go都是结构体,但仍然适用)
6.常量:k开头,后每个单词首字母均大写,例如kTableNumber
7.常规函数:每个单词首字母均大写,不加下划线,例如DeleteNumber
8.取值和设值函数:取值和设值函数要与存取的变量名匹配,例如获取变量count,则其函数为get_count,设置变量day,则其函数为set_day

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions