www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Regarding a recent copy() fix

In this bug report they have fixed a problem with copy():
http://d.puremagic.com/issues/show_bug.cgi?id=7484#c2

There I have suggested to use memmove() when the array slices overlap (and the
items don't have a postblit). Do you know why memmove() is not good here?

David Simcha has already given me an answer, but I am being dumb, and I don't
understand:

 I don't think it would have the same semantics in all cases.  memmove()
 requires semantics identical to if an intermediate buffer were used.  Imagine
 copying a[4..9] to a[5..10].
Bye and thank you, bearophile
Feb 12 2012