Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!leah!itsgw!steinmetz!uunet!portal!cup.portal.com!wert From: wert@cup.portal.com (robert scott comer) Newsgroups: comp.sys.mac Subject: Silly strcpy Message-ID: <15380@cup.portal.com> Date: 4 Mar 89 20:27:20 GMT References: <41a2364a.a590@mag.engin.umich.edu> <70755@ti-csl.csc.ti.com> <41aa5eaa.a590@mag.engin.umich.edu> <15682@versatc.UUCP> <2606@ncsuvx.ncsu.edu> Organization: The Portal System (TM) Lines: 24 > For general amusement, try looking at the generated code for the following > in LightSpeed C 3.0 > > strcpy (out, in) > char *out, *in; > { > while (*in) > *out++ = *in++; > } > There are several problems here: 1) No register declarations (for stupid compilers), and 2) This code fails to copy the terminating null. Better would be: strcpy (out, in) register char *out, *in; { while (*out++ = *in++); } scott comer