Changes between Version 13 and Version 14 of CodingGuidelines
- Timestamp:
- Mar 29, 2012, 10:46:25 AM (13 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
CodingGuidelines
v13 v14 163 163 164 164 This way we can control the verbosity of the code easily and we do not end up with many commented-out wasteland alike ''... //std::cout << "Variable bla is " << ...''. 165 166 === Use constructors initialization list properly === #code-good-bad-constructor-initialization 167 168 Constructors may be given an initialization list, e.g. 169 {{{ 170 class SomeClass { 171 ... 172 double test; 173 ... 174 }; 175 176 SomeClass::SomeClass() : 177 test(0.) 178 {} 179 180 SomeClass::SomeClass(const double t) : 181 test(t) 182 {} 183 }}} 184 This is more efficient that setting the value in the constructor's body because the constructor of ''test'' gets called with the correct value right away instead of default constructor and then assignment operator.