Re: Difference between memcpy() and memmove()

From: Artie Gold (artiegold_at_austin.rr.com)
Date: 08/16/04


Date: Sun, 15 Aug 2004 17:54:14 -0500

conf wrote:
> What are the differences between memcpy() and memmove()? Thank you very
> much!
>

memmove() allows the source and destination to overlap -- memcpy() does not.

HTH,
--ag

-- 
Artie Gold -- Austin, Texas
20050120->44


Relevant Pages

  • Re: anti-aliasing
    ... because memcpy() is defined as UB if passed aliased ... The snag is that memmove() is called memmove. ... If I was reviewing the code and the programmer could not either prove the regions would never overlap or that it was valid that the regions overlapped and it was handled properly I would reject it. ...
    (comp.lang.c)
  • Re: Copying Aggregate Data Types in C
    ... memmove, I should think, rather than memcpy. ... achieved without undefined behavior - do you know of any? ... Are you saying that memmove() is cool with memmove? ... It would be a problem with memcpy; but the whole point of memmove is that it has defined behavior even when the source and destination overlap. ...
    (comp.lang.c)
  • Re: anti-aliasing
    ... that to allow aliases and efficinet copying of non-aliases. ... because memcpy() is defined as UB if passed aliased ... As a general rule is is better to avoid bugs than speed ... If you want the memmove() behaviour, use memmove, and don't ...
    (comp.lang.c)
  • Re: set double array to 0.0
    ... > The functions memmove() and memcpy() both copy data from the source buffer ... > guaranteed to copy overlapping buffers correctly. ... > I had a look at the optimized assembler source code in the VC runtime ...
    (comp.lang.c)
  • Re: anti-aliasing
    ... The snag is that memmove() is called memmove. ... Psychology matters. ... memmovewere called memcpy() and memcpyfast_memcpy, ... incorrectly so the programmer learns to use it properly. ...
    (comp.lang.c)