Changes between Version 15 and Version 16 of CodingRules


Ignore:
Timestamp:
11/26/13 16:16:07 (11 years ago)
Author:
tbretz
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • CodingRules

    v15 v16  
    43430. typedefs should end with a _t like UInt_t
    44440. 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.
     450. 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.
    4646
    4747