Thread overview |
---|
November 30, 2015 Constness understanding | ||||
---|---|---|---|---|
| ||||
I have some struct and other struct stores reference to the first one like a pointer to constant. Nevertheless I can change the value of the first struct. Is it some hack? http://dpaste.dzfl.pl/0dfa3dff2df7 |
November 30, 2015 Re: Constness understanding | ||||
---|---|---|---|---|
| ||||
Posted in reply to drug | Unfortunately in D constant doesn't mean constant :( it means readonly: you can read it, but it can change in other ways. Immutable means constant - doesn't change in any way. |
November 30, 2015 Re: Constness understanding | ||||
---|---|---|---|---|
| ||||
Posted in reply to Kagamin | On 30.11.2015 13:27, Kagamin wrote:
> Unfortunately in D constant doesn't mean constant :( it means readonly:
> you can read it, but it can change in other ways. Immutable means
> constant - doesn't change in any way.
Thanks, considering 'const' as 'readonly' explains my case rather well.
|
Copyright © 1999-2021 by the D Language Foundation