forked from bluehavana/sword
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CODINGSTYLE
81 lines (67 loc) · 1.24 KB
/
CODINGSTYLE
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
recommended:
tab = 5
shiftwidth = 5
required:
use tab character for indents
for (init; condition; increment) {
statement;
}
switch (variable) {
case 1:
statement;
statement;
break;
case 2: statement; break;
case 3: statement; break;
case 4:
statement;
break;
default:
statement;
break;
}
if (condition)
statement;
else statement;
if (condition) {
statement;
statement;
}
else {
statement;
statement;
}
class ClassDef {
private:
protected:
/** This method does something
* @param paramName1 the first parameter name
* @param param2 the second parameter name
* @return error status
*/
char methodName(int paramName1, char param2 = -1);
/** This method does something too
*/
void anotherMethodName() { someShortExpression; }
public:
ClassDef();
};
char ClassDef::methodName(int paramName1, char param2) {
char retVal = 0;
// do something;
return retVal;
}
ClassDef classDef;
classDef.methodName(1, '2');
if (((reallyLongCondition) && (moreLogic)) ||
(otherCondition)) {
expression;
}
int varName1 = 1;
char *variable2 = "2";
int &var3 = varName1;
int variable4, variable5, var6, var7;
variable4 = 4;
variable5 = 5;
var6 = 6;
var7 = 7;