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: String copy idiom.
Message-ID: <7042@watdaisy.UUCP>
Date: Thu, 7-Mar-85 21:57:26 EST
Article-I.D.: watdaisy.7042
Posted: Thu Mar  7 21:57:26 1985
Date-Received: Fri, 8-Mar-85 03:30:43 EST
Distribution: net
Organization: U of Waterloo, Ontario
Lines: 16

A recent article on language idioms gave the following C code
for a string copy:

     while (*s++ = *t++);

Serious C hackers should know that on VAX 4.2 BSD UNIX this
code produces a loop with 50% more assembler instructions
than the slightly clearer sequence:

     while ((*s = *t) != '\0')
     {   s++;
	 t++;
     }

This is true whether or not the object-code improver
is invoked, and may be true on other machines as well.