memcpy vs. memmove (was: Re: Explanation, please!)

Doug Gwyn gwyn at smoke.ARPA
Tue Sep 13 23:40:47 AEST 1988


In article <7039 at bloom-beacon.MIT.EDU> scs at adam.pika.mit.edu (Steve Summit) writes:
>I'll probably be disgusted by the answer, but can someone explain
>why two functions are needed instead of one?  Why not just add
>the guarantee to memcpy?

(1) many people want a fast block-move, many want one that does the
"correct" thing on overlaps.  Two routines allows the application to
choose the trade-off.  A vendor could choose to make memcpy just
another entry point for memmove.

(2) it's possible that some existing (nonportable) applications depend
on the specific implementation of their current memcpy().



More information about the Comp.lang.c mailing list