[comp.sys.mac] Silly strcpy

wert@cup.portal.com (robert scott comer) (03/05/89)

> 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