Const Correctness

suggest change

Syntax

Remarks

const correctness is a very useful troubleshooting tool, as it allows the programmer to quickly determine which functions might be inadvertently modifying code. It also prevents unintentional errors, such as the one shown in Const Correct Function Parameters, from compiling properly and going unnoticed.

It is much easier to design a class for const correctness, than it is to later add const correctness to a pre-existing class. If possible, design any class that can be const correct so that it is const correct, to save yourself and others the hassle of later modifying it.

Note that this can also be applied to volatile correctness if necessary, with the same rules as for const correctness, but this is used much less often.

Refrences :

ISO_CPP

http://stackoverflow.com/questions/136880/sell-me-on-const-correctness

C++ Tutorial

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:


Const correctness:
* Const Correctness

Table Of Contents
8 Arrays
11 Loops
39 Streams
51 Unions
56 Lambdas
60 SFINAE
62 RAII
67 Sorting
84 RTTI
87 Scopes
104 Profiling
107 Recursion
114 Const correctness
117 Iteration
125 Alignment
134 Semaphore
136 Debugging
139 Mutexes
142 decltype