Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > memcpy verses memmove

Reply
Thread Tools

memcpy verses memmove

 
 
rinku24@yahoo.com
Guest
Posts: n/a
 
      02-14-2005
What is the difference between memcpy and memmove? Which is more
expensive?

 
Reply With Quote
 
 
 
 
Ruslan Abdikeev
Guest
Posts: n/a
 
      02-14-2005
<(E-Mail Removed)> wrote in message
news:(E-Mail Removed) ups.com...
> What is the difference between memcpy and memmove? Which is more
> expensive?


memcpy expects that source and destination areas do not overlap.
It is undefined behaviour to give memcpy overlapping areas (and in C99,
memcpy has "restrict" qualifiers on both sides).
memmove behaves correctly in case of overlapping areas, but it is
potentially more expensive.

Hope it helps,
Ruslan Abdikeev.


 
Reply With Quote
 
 
 
 
Gianni Mariani
Guest
Posts: n/a
 
      02-14-2005
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> What is the difference between memcpy and memmove? Which is more
> expensive?
>


memmove is ever so slightly more expensive because it does a check of
wether it needs to do a copy forward or copy backward.

On some systems, memcpy is the same routine as memmove.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Question regarding memcpy and memmove function somenath C Programming 16 09-04-2007 11:04 AM
memcpy vs memmove xdevel C Programming 6 07-04-2007 04:03 AM
diff memcpy and memmove novice C Programming 8 03-10-2006 08:01 PM
memcpy/memmove Christopher Benson-Manica C Programming 39 11-20-2003 01:15 PM
resolved: difference between memcpy and memmove Mike Wahler C Programming 21 09-30-2003 08:31 PM



Advertisments