7 mike 1.1
8 2. Use "char* x" rather than "char *x".
9
10 3. Put opening brace on a line by itself.
11
12 4. ThisIsAClassName - no underscores.
13
14 5. thisIsAMethodName() - no underscores.
15
16 6. Lines should not span more than 80 columns.
17
18 7. When methods span more than 80 columns, do this:
19
20 void MyClass::myMethod(
21 const char* someReallyLongName,
22 const char* someOtherReallyLongName);
23
24 8. Use const whenever possible.
25
26 9. Use const methods whenever possible.
27
28 mike 1.1 10. Braces must be aligned with control keyword:
29
30 for(...)
31 {
32 }
33
34 Not this:
35
36 for (...)
37 {
38 }
39
40 11. No spaces after names:
41
42 Not "void f ()" but "void f()".
43
44 12. Avoid this:
45
46 callingMyFunction(blah,
47 blah2,
48 blah3);
49 mike 1.1
50 Do this:
51
52 callingMyFunction(
53 blah,
54 blah2,
55 blah3);
56
57 13. Avoid this:
58
59 int x;
60 float y;
61
62 14. Use 0 and not NULL.
63
64 15. Don't commit anything that breaks the build (try a clean slate
65 checkout and build).
66
67 16. Files should take advantage of case and avoid underscores.
68 Files should have the same name as the class (and same case).
69
70 mike 1.1 17. Separate functions with blank lines.
71
72 class X
73 {
74 public:
75
76 void f();
77
78 void g();
79 };
80
81 18. No warnings should be committed.
82
83 19. Test big changes on at least Windows and Unix (or Linux)
84
85 20. Move SLP out of Common.
86
87 21. Changes must work on all platforms. Commits must not break any
88 platform.
89
90 22. No binaries may be committed to repository.
|
91 mike 1.2
92 24. Don't separate return type onto its own line:
93
94 Avoid this:
95
96 int
97 f()
98 {
99 }
100
101
102 25. All code must be reachable (built) from master makefile. Otherwise
103 it will not be reached when doing mass substitutions, testings of
104 builds, and license changes.
105
106 26. Prepend '_' to private members (including methods).
107
108 27. Use /** */ rather than /// for DOC++.
109
110 29. Always write a regression test for everything.
111
112 mike 1.2 30. Always build and run all regression tests before committing.
113
114 31. Be mindful that the tests must run on all supported platforms and
115 that a commit may break another platform.
|