Article View: comp.sys.mac
Article #38782Silly strcpy
From: robert scott comer
Date: Sat, 04 Mar 1989 20:27
Date: Sat, 04 Mar 1989 20:27
24 lines
986 bytes
986 bytes
> 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
Technical Details
Message-ID:
<15380@cup.portal.com>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!leah!itsgw!steinmetz!uunet!portal!cup.portal.com!wertReferences:
<IY0io5y00UgPAM2b4a@andrew.cmu.edu> <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>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!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: <IY0io5y00UgPAM2b4a@andrew.cmu.edu> <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