Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site alice.UUCP Path: utzoo!linus!philabs!cmcl2!seismo!lll-crg!dual!qantel!ihnp4!mhuxn!mhuxm!sftig!sfmag!eagle!ulysses!allegra!alice!ark From: ark@alice.UUCP (Andrew Koenig) Newsgroups: net.lang.c Subject: Re: Cryptic C code? Message-ID: <4129@alice.UUCP> Date: Sun, 11-Aug-85 19:18:21 EDT Article-I.D.: alice.4129 Posted: Sun Aug 11 19:18:21 1985 Date-Received: Wed, 14-Aug-85 22:35:44 EDT References: <359@tektools.UUCP> Organization: Bell Labs, Murray Hill Lines: 26 strcpy(s, t) /* copy t to s; pointer version 3 */ char *s, *t; { while (*s++ = *t++) ; } strcpy(s,t) /* copy t to s; pointer version 2 */ char *s, *t; { while ((*s++ = *t++) != '\0') ; } > Does anyone out there support the author by saying that Version 3 of > 'strcpy' is better than Version 2? Yes. In version 3, I am saying that the character that terminates a string is the same character is that is the implicit subject of an unstated comparison in a `while' statement. In version 2, the string terminator is an explicitly stated constant. Viewed that way, the two versions are equivalent only by coincidence.