All of lore.kernel.org
 help / color / mirror / Atom feed
From: Robert Hancock <hancockr@shaw.ca>
To: sk malik <srikrishanmalik@yahoo.co.in>
Cc: linux-kernel@vger.kernel.org
Subject: Re: why use memcpy when memmove is there?
Date: Mon, 13 Aug 2007 08:33:03 -0600	[thread overview]
Message-ID: <46C06B9F.6080603@shaw.ca> (raw)
In-Reply-To: <fa.tH0XPZg4jvmqSQh3iOmzbwrRN9Y@ifi.uio.no>

sk malik wrote:
> Hi, All
> 
> We were looking at  "[kernel]/lib/string.c"
> (http://lxr.linux.no/source/lib/string.c#L500)
> 
> memcpy copies a part of memory to some other location
> but It will not work for all cases of overlapping
> blocks.(if the start of destination block falls
> between the source block)
> 
> while memove copes with overlapping areas.
> 
> then why is memcpy present in the sources can't we
> simply do
> 
> "#define memcpy memmove" in include/linux/string.h
> 
> or am I missing something?

Because the assumption that the areas don't overlap means memcpy can be 
more efficient.

-- 
Robert Hancock      Saskatoon, SK, Canada
To email, remove "nospam" from hancockr@nospamshaw.ca
Home Page: http://www.roberthancock.com/


       reply	other threads:[~2007-08-13 16:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <fa.tH0XPZg4jvmqSQh3iOmzbwrRN9Y@ifi.uio.no>
2007-08-13 14:33 ` Robert Hancock [this message]
2007-08-13 10:55 why use memcpy when memmove is there? sk malik
2007-08-13 14:15 ` Jan Engelhardt
2007-08-13 15:02 ` Stefan Richter
2007-08-14 21:59 ` David Schwartz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=46C06B9F.6080603@shaw.ca \
    --to=hancockr@shaw.ca \
    --cc=linux-kernel@vger.kernel.org \
    --cc=srikrishanmalik@yahoo.co.in \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.