www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/12/09/14:15:55

Message-ID: <366EC5A6.E2EDB2A9@videotron.ca>
From: Stephane Hockenhull <potam AT videotron DOT ca>
Organization: Potam Soft
X-Mailer: Mozilla 4.04 [en] (Win95; I)
MIME-Version: 1.0
Newsgroups: comp.os.msdos.djgpp
Subject: Re: memcpy() vs memmove()
References: <74ll3i$h7k$1 AT hermes DOT is DOT co DOT za> <74lqta$l3o$1 AT antares DOT lu DOT erisoft DOT se> <74lrv4$k9i$1 AT hermes DOT is DOT co DOT za>
Lines: 29
Date: Wed, 09 Dec 1998 13:47:02 -0500
NNTP-Posting-Host: 207.96.133.152
X-Complaints-To: abuse AT videotron DOT net
X-Trace: weber.videotron.net 913229242 207.96.133.152 (Wed, 09 Dec 1998 13:47:22 EDT)
NNTP-Posting-Date: Wed, 09 Dec 1998 13:47:22 EDT
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Freddie Schwenke wrote:
> 
> I'm quite aware that there is a differrence between the two functions.  I
> actually want to abuse the memcpy() function to replicate one ore more bytes
> throughout a string.  The problem is that memcpy() only works while the
> length is less that 16.  WHY???
> 
> Is this a C thing or a DJGPP thing?  In MS Visual C++ apparently there is no
> difference betwee the two functions!!!
> 

try:

for (int i=0; i < 9; i++){
	buffer[i+1] = buffer[i];
}

you'll be sure it work the same in any compiler.

the reason why memcpy() might not work as expected (the one i think why,
i didnt look at the memcpy() source tho) is because over 15 chars it
could use 32bit memory copy (for speed reasons) while memmove() would
always use byte per byte copy (slower)

-- 
Stephane Hockenhull
Rv[PotamSoft]
mailto:potam AT videotron DOT ca
http://pages.infinit.net/potam/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019