Regarding a recent copy() fix

bearophile bearophileHUGS at lycos.com
Sun Feb 12 14:10:41 PST 2012


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


More information about the Digitalmars-d-learn mailing list