I hate ".dup"

Jarrett Billingsley jarrett.billingsley at gmail.com
Mon Mar 23 10:09:03 PDT 2009

On Mon, Mar 23, 2009 at 12:15 PM, BCS <none at anon.com> wrote:
> Hello Qian,
>> Oh god. I have to add ".dup" at the end of every string to avoid
>> potential program errors. This is so incredible....
> Run it on linux and it will seg-v when you try to access a literal string.
> Oh, and that issue is in no way unique to D. Any language with mutable
> strings will have it and any language without will force the copies anyway
> (but with better syntax)

It is unique to DMD/Optlink.  GDC Win will produce EXEs that throw a
segfault if you attempt to modify a read-only string.

More information about the Digitalmars-d-learn mailing list