array initialization problem

Qian Xu quian.xu at stud.tu-ilmenau.de
Mon Jan 19 01:21:59 PST 2009


Denis Koroskin wrote:

> ...
> 
> For example, let's modify CSTR and see what happens:
> CSTR[0] = 'J'; // now it is "Jello"
> 
> printing e.str and e2.str gives us the following output:
> Jello
> Jello
> 
> ...

Hi again,

but there is one thing, I do not understand.
CSTR is a constant. But with "CSTR[0] = 'J'", you can modify a const anyway,
cannot you?

BTW: Do you know, why D do not use copy-on-write semantic instead of
referencing? IMO, copy-on-write is much performanter.

--Qian


More information about the Digitalmars-d-learn mailing list