How do I translate this bit of code from C(using pointers) to D?
MacAsm via Digitalmars-d
digitalmars-d at puremagic.com
Wed Aug 27 12:52:42 PDT 2014
On Tuesday, 26 August 2014 at 21:29:04 UTC, H. S. Teoh via
Digitalmars-d wrote:
> On Tue, Aug 26, 2014 at 08:58:13PM +0000, MacAsm via
> Digitalmars-d wrote:
>> It maybe trivial to most of you but I don't know how do this
>> avoiding
>> string duplications. Can someone help me?
> [...]
>> in D, I can wrote as following:
> [...]
>> void move(int n)
>> {
>> prev = str; // <- I want to avoid this string duplication
>> did in every move() call
>
> This does not duplicate the string. You may find this article
> helpful:
>
> http://dlang.org/d-array-article.html
>
>
>
Thanks. This is exactly what I was worried about. If no string
duplciation is done I think this D code is just fine...
More information about the Digitalmars-d
mailing list