4 ms·
> const does not guarantee that the memory at the location pointed to won't change I didn't say this. I said a `const` function tells the reader that the state
by jpcfl 3y ago
> const does not guarantee that the memory at the location pointed to won't change
I didn't say this. I said a `const` function tells the reader that the state of an object doesn't change.
Another reader correctly pointed out that there are ways to modify the state of a `const` parameters (indirection and const cast), but I would argue that such an API is poorly-designed.
To qualify my original comment, a reader only knows a function doesn't change an object's state if the API is well-designed.