Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.1 6/24/83; site petsd.UUCP
Path: utzoo!watmath!clyde!burl!ulysses!mhuxr!ihnp4!houxm!vax135!petsd!joe
From: joe@petsd.UUCP (Joe Orost)
Newsgroups: net.lang.c
Subject: Re: String copy idiom.
Message-ID: <464@petsd.UUCP>
Date: Sat, 9-Mar-85 13:16:48 EST
Article-I.D.: petsd.464
Posted: Sat Mar  9 13:16:48 1985
Date-Received: Sun, 10-Mar-85 07:37:15 EST
References: <7044@watdaisy.UUCP> <3448@alice.UUCP>
Reply-To: joe@petsd.UUCP (Joseph M. Orost)
Organization: Perkin-Elmer DSG, Tinton Falls, N.J.
Lines: 25
Summary: 

In article <3448@alice.UUCP> ark@alice.UUCP (Andrew Koenig) writes:
>If s and t are char pointers in registers,
>
>	while (*s++ = *t++) ;
>
>generates the best code I could possibly imagine.
>
>	while ((*s = *t) != '\0') {s++; t++;}
>
>is considerably worse.  Try it with register variables on your compiler.

Ok, I did.  The second sequence generates less code than the first sequence
on our machine (Perkin-Elmer).  This is due to the fact that our machine
doesn't support auto-increment in hardware.  The C compiler has to "fake" it.

					regards,
					joe

--
Full-Name:  Joseph M. Orost
UUCP:       ..!{decvax,ucbvax,ihnp4}!vax135!petsd!joe
ARPA:	    vax135!petsd!joe@BERKELEY
US Mail:    MS 313; Perkin-Elmer; 106 Apple St; Tinton Falls, NJ 07724
Phone:      (201) 870-5844
Location:   40 19'49" N / 74 04'37" W