[Coco] Fwd: MW-C Cross compiler bug - Solved

Bill Pierce ooogalapasooo at aol.com
Sun Mar 9 19:18:31 EDT 2014


Gene &Frank... Neither of you must have looked well at the title of the thread.
It's says "Cross compiler" not OS9 compiler. They are working on PC code and not Coco OS9 code.
Though in the end, the end result must be K&R compliant (of sorts), but the code they are working on are the sources to the cross compiler which is compiled under GCC. 


Bill Pierce
"Today is a good day... I woke up" - Ritchie Havens
 

My Music from the Tandy/Radio Shack Color Computer 2 & 3
https://sites.google.com/site/dabarnstudio/
Co-Webmaster of The TRS-80 Color Computer Archive
http://www.colorcomputerarchive.com/
Co-Contributor, Co-Editor for CocoPedia
http://www.cocopedia.com/wiki/index.php/Main_Page
E-Mail: ooogalapasooo at aol.com




-----Original Message-----
From: Gene Heskett <gheskett at wdtv.com>
To: coco <coco at maltedmedia.com>
Sent: Sun, Mar 9, 2014 5:56 pm
Subject: Re: [Coco] Fwd:  MW-C Cross compiler bug - Solved


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