Changes between Version 14 and Version 15 of CodingRules
- Timestamp:
- 11/26/13 16:14:35 (12 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
CodingRules
v14 v15 42 42 0. directory names should be lower case only (to easy distinguishable from source code files) 43 43 0. typedefs should end with a _t like UInt_t 44 44 0. Try to avoid code repetitions. Invent a new function instead. 45 0. Move code to their own function, If otherwise the structure gets too complicated. A typical example is "MyClass *ptr = new MyClass; CallFunction(ptr); delete ptr;" is much easier than "MyClass *ptr = new MyClass; if (...) { delete ptr; return; } if (...) { delete ptr; return; } delete ptr;" In a similar case "int i = Find(a);" with something like "int Func(int a) { for (int i=0; i<n; i++) { if (x[i]==a) return i; if (x[i]==a+1) return a+1; ... } return -1; }" then if you try to construct the same with breaks and variables declared outside of the for-scope. 45 46 46 47