Path: utzoo!mnetor!uunet!husc6!uwvax!oddjob!gargoyle!att-ih!ihnp4!twitch!anuck!jrl From: jrl@anuck.UUCP (j.r.lupien) Newsgroups: comp.lang.c Subject: Re: strcpy Message-ID: <545@anuck.UUCP> Date: 23 Mar 88 16:29:28 GMT References: <793@cresswell.quintus.UUCP> Organization: AT&T Bell Labs, Andover Ma. Lines: 27 From article <793@cresswell.quintus.UUCP>, by ok@quintus.UUCP (Richard A. O'Keefe): > The UNIX manuals say of strcpy(s1, s2) that it > "copies s2 to s1, stopping after the null character has been copied." > While they doesn't strictly speaking say anything about the order in which > the other characters are copied, they _do_ say that the NUL character must > be copied last, so Stopping after something occurs, as with "after the NULL has been copied" does NOT equate, as you go on to assume, to "nothing will be done after the NULL is copied. The function will return immediately." The definition says "after". "After", as I recall, means "not before", which in no way precludes doing the required act first, and taking care of other requirements next. As an aside, I would be loathe to assume that the string was copied front to rear even if the function WAS so specified. Documentation has been known in the past to lag or lead the actual code, or to simply ignore it. The moral of this is, don't depend on bizarre side effects unless there is no other efficient way to get the job done, and even then be quite sure that things work the way you expect (test it). Be prepared to adopt some less efficient method, because you WILL get bitten. John R. Lupien twitch!mvuxa!anuxh!jrl Watch out for that pirrhana!