Moving structs containing strings ...

Bob W nospam at aol.com
Sun Apr 23 18:45:18 PDT 2006


"Derek Parnell" <derek at psych.ward> wrote in message 
news:op.s8hhktza6b8z09 at ginger.vic.bigpond.net.au...
> On Mon, 24 Apr 2006 08:44:57 +1000, Bob W <nospam at aol.com> wrote:
>
> For a workaround,
>
>    with (arr[0]) { idz[]="ab\0";  id=idz[0..2];  val=101; }
>    with (arr[1]) { idz[]="cd\0";  id=idz[0..2];  val=102; }
>    with (arr[2]) { idz[]="ef\0";  id=idz[0..2];  val=103; }
>
> replace those lines with
>
>   with (arr[0]) { idz[]="ab\0";  id=idz[0..2].dup;  val=101; }
>   with (arr[1]) { idz[]="cd\0";  id=idz[0..2].dup;  val=102; }
>   with (arr[2]) { idz[]="ef\0";  id=idz[0..2].dup;  val=103; }
>
>
> -- 
> Derek Parnell
> Melbourne, Australia

Thanks for your suggestion. But I am more keen to know
why the example mentioned in my post is not producing
the desired results than in applying a workaround.

If this question remains unanswered I'll have to revert
to using pointers for the application which initially has
produced these erroneus results. Using '.dup' several
million times would probably bring my system to a
standstill. I might be wrong with this guess, however ...






More information about the Digitalmars-d-bugs mailing list