String copy idiom.

Jeff Anton anton at ucbvax.ARPA
Wed Mar 13 03:18:26 AEST 1985


Daniel J. Salomon writes:
>The VAX 4.2 BSD UNIX library routine 'strcpy' uses code equivalent
>to the less efficient sequence:  while (*s++ = *t++);
>Perhaps it should be changed.
>In the mean time, if your application does a great deal of
>string copying, and you are want to minimize execution time,
>you should write your own string copy routine.

I believe you are mistaken.  The 4.2BSD VAX strcpy is an assembly routine
that uses the VAX instruction movc3.  Perhaps, your library was built
improperly or you defined a new strcpy routine.  If you looked at source
code you must be carefull since routines in assembly often have C counter
parts to be used if the assembly is suspect.
-- 
C knows no bounds.
					Jeff Anton
					U.C.Berkeley
					ucbvax!anton
					anton at berkeley.ARPA



More information about the Comp.lang.c mailing list