Content deleted Content added
Major rewrite. |
|||
Line 55:
===Loop-holes to <code>const</code>-correctness===
There are two loop-holes to pure <code>const</code>-correctness in C and C++.
The first, which applies only to C++, is the use of <code>const_cast</code>, which allows the programmer to strip the <code>const</code> qualifier, making any object modifiable. The necessity of stripping the qualifier arises when using existing code and libraries that cannot be modified but which are not <code>const</code>-correct. For instance, consider this code:
<code>
// Prototype for a function which we cannot change but which
// we know does not modify the pointee passed in.
void LibraryFunc( int * ptr, int size );
|