There are many statements about C++ code style, and I would only mention what troubled me in the past.
1)
A default value must be initialized for variables in c++; otherwise, code works in debug mode while not in release mode for undefined value in the memory for those variables.
2)
For the classes used, Prefer foreward declare (前置申明) to include a header file for it
//class Class Aclass
//struct Extern Astruct;
|
3)
a acceptable way for naming variables in C++ as below:
变量命名
m_ 成员变量
l_ 局部变量
a_ 输入参数变量
C 类名首字母
I “接口”类(纯虚抽象类)名首字母