Meaning of const variables

jmh530 via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Jun 21 06:48:27 PDT 2016


On Tuesday, 21 June 2016 at 02:54:06 UTC, ketmar wrote:
>

Thanks to you and the others for the detailed clarifications. I 
think part of the difficulty is that there are basically three 
things being discussed that are all very similar: an alias to 
data, a pointer to data, and a view of data.

>
> so, what that quote essentially means is: "`const` pointers can 
> point to mutable data, but `immutable` pointers cannot".
>

So an immutable pointer guarantees that whatever it is pointing 
to will never change, but a const pointer can also point to 
mutable data, which might change some other way.


More information about the Digitalmars-d-learn mailing list