www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - const const(char)[]

reply Funog <funog ifrance.com> writes:
Isn't const const(char)[] equivalent to invariant(char[]) ?
Jul 06 2007
parent torhu <fake address.dude> writes:
Funog wrote:
 Isn't const const(char)[] equivalent to invariant(char[]) ?
It doesn't seem to matter whether the brackets are inside or outside the parens. Only the char part is made const or invariant. I did some testing, and couldn't find any difference. Someone please correct me if I'm wrong. If you're talking about the difference between const and invariant: const means that the contents of the array can't be changed through that reference. invariant means that no other reference can change the contents either. This article explains it well: http://www.digitalmars.com/d/const.html
Jul 06 2007