1. Variable name
Type |
Naming conventions |
Example |
Member variables |
M_ |
int M_nvalue |
static variables |
S_ |
int S_nlength |
Static member variables |
Sm_ |
char* Sm_strname |
Global variables |
G_ |
int G_nvalue |
|
|
|
Boolean variable bool |
B
|
BOOL Bstate |
Character Char |
C |
Char Cgrade |
Strings string |
Str |
char* StrName |
Shaping variable int |
N |
int Nlength |
unsigned shaping unsigned int |
U
|
unsigned usize |
Floating-point variable float |
F
|
Float Fscore |
Double floating-point variable double |
D |
Double Dscore |
Pointer variable |
P |
int* Parray |
Array |
G |
int garray[100] |
Enumeration members |
K |
enum {kwalk=0, ...}; |
|
|
|
2. Functions
The first word is a verb and the following word is a name.
The first letter is lowercase and the first letter of the following word is capitalized.
(1) dosomething ()
(2) Dowithresourse ()
(3) Oneventcallback ()
(4) Getinstanse ()
3. Class Name
Each word is capitalized in the first letter. Gamelayer
4. Macro definition
All uppercase letters are composed, and the words are defined by underscores.
#define GANE_EASY 1
This article is from the "Summer Wind" blog, please be sure to keep this source http://shahdza.blog.51cto.com/2410787/1549514
c++11--Naming conventions