Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site watdaisy.UUCP Path: utzoo!watmath!watdaisy!djsalomon From: djsalomon@watdaisy.UUCP (Daniel J. Salomon) Newsgroups: net.lang.c Subject: Re: String copy idiom. Message-ID: <7047@watdaisy.UUCP> Date: Fri, 8-Mar-85 13:36:17 EST Article-I.D.: watdaisy.7047 Posted: Fri Mar 8 13:36:17 1985 Date-Received: Sat, 9-Mar-85 08:04:29 EST References: <7042@watdaisy.UUCP> <7044@watdaisy.UUCP> Distribution: net Organization: U of Waterloo, Ontario Lines: 12 > 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. > SORRY for this error. The idiom "while (*s++ = *t++);" generates the fastest possible code if s and t are declared to be registers, which they are in the system version of strcpy. But note that if s and t are not in registers then the sequence: while (*s = *t) {s++; t++;} is more efficient.