const in dmd v2.011

Jason House jason.james.house at gmail.com
Wed Feb 20 16:03:56 PST 2008


It seems like you may have read some very early D 2.x docs on const and not
read the later D 2.x docs.  The const design has changed a lot.

Derek Parnell wrote: 
> Observations:
> ** It appears that there is no practical difference between 'const(C) c'
> and 'const C c'.

This is the definition of transitive const.  



> ** It appears that 'const(char[])' and 'const const(char)[]' are
> equivalent and also not implemented well (or the error messages are just
> bad).

const(char)[] means the char's within the array can't be changed, but the
array itself can change (ie. length changes, concatenation)



More information about the Digitalmars-d-learn mailing list