Changes between Version 7 and Version 8 of CodingGuidelines


Ignore:
Timestamp:
Mar 29, 2012, 10:26:05 AM (13 years ago)
Author:
FrederikHeber
Comment:

Added style on const members

Legend:

Unmodified
Added
Removed
Modified
  • CodingGuidelines

    v7 v8  
    110110}}}
    111111Also remember that there are also ::infinity() and alikes to set an illegal value which can be checked.
     112
     113=== Make use of declaring member variables and functions const === #code-good-bad-const-members
     114
     115We want to have a clean interface. Hence, it is vital to state in the interface that a function does not change the internal state of a class instance. If so, make it __const__.
     116
     117The same holds for variables. If they are set in the constructor and only read afterwards, make them __const__.
     118
     119''Note: const variables are tricky with [http://www.boost.org/libs/serialization serialization], but in this specific case it is allowed to use '''const_cast<>()''' to allow writing a const member variable outside the constructor.''