const const(char)[]

torhu fake at address.dude
Fri Jul 6 06:07:05 PDT 2007

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:

More information about the Digitalmars-d-learn mailing list