Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S943381AbXHMPzA (ORCPT ); Mon, 13 Aug 2007 11:55:00 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S946608AbXHMOP3 (ORCPT ); Mon, 13 Aug 2007 10:15:29 -0400 Received: from sovereign.computergmbh.de ([85.214.69.204]:45647 "EHLO sovereign.computergmbh.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S946593AbXHMOP0 (ORCPT ); Mon, 13 Aug 2007 10:15:26 -0400 Date: Mon, 13 Aug 2007 16:15:25 +0200 (CEST) From: Jan Engelhardt To: sk malik cc: linux-kernel@vger.kernel.org Subject: Re: why use memcpy when memmove is there? In-Reply-To: <977159.24669.qm@web7606.mail.in.yahoo.com> Message-ID: References: <977159.24669.qm@web7606.mail.in.yahoo.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 918 Lines: 30 On Aug 13 2007 11:55, sk malik wrote: >Subject: why use memcpy when memmove is there? >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? memmove must copy with overlapping memory segments, while memcpy does not, and can therefore use a different optimization strategy. But that would have been apparent if you had looked at the code. Jan -- - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/