通用命名规则
-------
tab 键的空格数设置为4个。
在每处都使用大括号(if,else,函数,结构体,typedef,类定义,等等)
if ( x ) {
}
else 代码段的左大括号 与 右大括号开始在同一行
if ( x ) {
} else {
}
表达式与左右括号间要用空格空开。
例如:用
if ( x ) {
}
代替如下语句
if (x) {
}
又如,用
x = ( y * 0.5f );
代替如下语句
x = (y * 0.5f);
为浮点值添加精度标示符,除非明确需要用到double
例如:用
float f =0.5f;
代替如下语句
float f =0.5;
又如,用
float f =1.0f;
代替如下语句
float f =1.f;
函数名以大写字母开头:
例如:
void Function( void );
若为多单词函数名,每个词以大写字母开头:
例如:
void ThisFunctionDoesSomething( void);
函数的标准头部注释如下:
/*
====================
FunctionName
Description
============