On Fri, 16 Jan 2009 19:15:03 +0300, Qian Xu <quian...@stud.tu-ilmenau.de> wrote:

Denis Koroskin wrote:

The "Hello, World!" string is not allowed to be modified, because it could
be shared throughot the project and will be most probably put in a
read-only memory causing segfault at modification.

But it you need to have a modified version of this this, you create its
copy (duplication, or 'dup' for short) and make whatever changes you want
to it...

This confuses me very.
Do you mean, there is no Copy-On-Write semantic in D?
IMO, D-Compiler should make decision about whether to allocate a new memory
block, not programmer.

--Qian

No, arrays have reference semantics (unlike std::string in C++) and thus 
changing data an array points to will have effect on all other arrays that 
share same data.

Reply via email to