confused with some_var.dup

Qian Xu quian.xu at stud.tu-ilmenau.de
Fri Jan 16 08:15:03 PST 2009


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


More information about the Digitalmars-d-learn mailing list