I get how. I don't get why. (more const stuff)
Gregor Richards
Richards at codu.org
Fri Sep 7 07:55:40 PDT 2007
Disclaimer: Non D2 user :)
'const' is a compiler-defined contract to say that you won't change
anything you don't own with respect to some variable. If that variable
is a struct passed as an argument (and therefore passed by value), you
DO own its members, but you do NOT own anything that its members point
to. Restricting you from changing the content of a local variable is
pointless, but const in this context would prevent you from changing
anything it points to.
To put it a different way: const never prevents you from changing local
data, it only prevents you from writing through pointers and references.
Redisclaimer: Any of this can be wrong, non D2 user :)
- Gregor Richards
More information about the Digitalmars-d
mailing list