Moving structs containing strings ...

Bob W nospam at aol.com
Sun Apr 23 19:22:53 PDT 2006


"kris" <foo at bar.com> wrote in message news:e2hbp1$pnk$1 at digitaldaemon.com...
>
> eeeewe :)
>
> The 'id' slices are mapped to absolute addresses, and thus are mapped to 
> specific addresses within the array.

Absolutely right! Now I am asking myself the usual question:
Why didn't I take a break over the weekend and recognize this
first thing on Monday morning?


> When you remove array element 0 and compress the array, those addresses 
> are not updated, and you end up with the result shown. After compression, 
> the 'id' slice for val:102 is still pointing at where it used to live, 
> although the original "cd" text has now been overwritten with the val:103 
> "ef" text instead :)
>
> The 'id' slice for val:103 is actually still pointing to its original 
> location, which is now /past/ the end of the array (hehe).
>
> One solution is to adjust each 'id' slice when you compress or otherwise 
> adjust the array content. Wouldn't you have to do this with pointers also?

I'll adjust. Thank you very much!






More information about the Digitalmars-d-bugs mailing list