[Coco] Fwd: MW-C Cross compiler bug - Solved
Frank Pittel
fwp at deepthought.com
Sun Mar 9 18:44:33 EDT 2014
I just got motivated to look up memcpy and memmove in the in my copy of the original
K&R and found no mention of either.
The Other Frank
On Sun, Mar 09, 2014 at 05:55:52PM -0400, Gene Heskett wrote:
> On Sunday 09 March 2014 17:42:49 Chris Osborn did opine:
>
> > On Mar 9, 2014, at 2:01 PM, Gene Heskett wrote:
> > > Are you saying that both of my copies (original and the "ANSI C"
> > > versions of the K&R books are wrong?
> >
> > Page 250 of my ANSI K&R 2nd Edition book says:
> >
> > void *memcpy(s,ct,n) copy n characters from ct to s, and return
> s.
> > void *memmove(s,ct,n) same as memcpy except that it works even if the
> > objects overlap.
> >
> > So yes, you're supposed to use memmove.
> >
> > The memcpy vs. memmove saga:
> >
> > http://www.win.tue.nl/~aeb/linux/misc/gcc-semibug.html
>
> I was gonna pull my copy down and quote its entries for strcpy(s,ct) and
> strncpy(s,ct,n) but I've apparently pulled it down for reference and laid
> it someplace in this midden heap, hopefully not forever. Ah, just found
> it, shove under the monitor right in front of me.
>
> There is no discussion as to the gotchas in using strcpy vs memcpy in K&R
> #2. At first glance they look interchangeable except strcpy would
> apparently stop the copy at the EOL character since it expects no n
> argument. strncpy(s,ct,n) would appear to be exactly the same as
> memcpy(s,ct,n) in its effect. But does our clib even have the memcpy? I
> haven't looked in yonks.
>
>
> Cheers, Gene
> --
> "There are four boxes to be used in defense of liberty:
> soap, ballot, jury, and ammo. Please use in that order."
> -Ed Howdershelt (Author)
> Genes Web page <http://geneslinuxbox.net:6309/gene>
>
>
> --
> Coco mailing list
> Coco at maltedmedia.com
> http://five.pairlist.net/mailman/listinfo/coco
More information about the Coco
mailing list