www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Constness understanding

reply drug <drug2004 bk.ru> writes:
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
Nov 30 2015
parent reply Kagamin <spam here.lot> writes:
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.
Nov 30 2015
parent drug <drug2004 bk.ru> writes:
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.
Nov 30 2015