[fpc-pascal] Move() vs MemCopy()

Florian Klaempfl florian at freepascal.org
Tue Sep 29 15:51:41 CEST 2009

Graeme Geldenhuys schrieb:
> 2009/9/29 Florian Klaempfl <florian at freepascal.org>:
>> Because it doesn't copy your ram modules ;)
> Well, if I move something (no matter what it is), it doesn't exist in
> the original location any more. Hence my confusion about the Move()
> procedure.

Indeed, the serious answer is:
move handles overlapping memory blocks correctly (so the data might not
existing anymore at the old location), memcpy doesn't do this and screws
things up when handling overlapping blocks. This is why e.g. C++ has
memmove as well which is more expensive than memcpy due to overlap checks.

More information about the fpc-pascal mailing list