strcpy: "after the null has been copied"

der Mouse mouse at mcgill-vision.UUCP
Fri Apr 8 18:40:15 AEST 1988


In article <793 at cresswell.quintus.UUCP>, ok at quintus.UUCP (Richard A. O'Keefe) writes:
> 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,

Ah, but they don't.  A strict interpretation would take your quote as
meaning nothing more than that strcpy is guaranteed to copy the null,
because it is specified that it won't stop before that, and does say
that it stops (after that).  Nothing is said (by the above quote) about
whether it copies anything after the null, or whether it does the null
(temporally) first, last, or somewhere in between.  There is a strong
implication that either (a) it doesn't copy the character after the
null or (b) that it copies the null last, depending on whether you take
"after" to mean in the array or in time, but it's only an implication,
and an ambiguous one at that.

					der Mouse

			uucp: mouse at mcgill-vision.uucp
			arpa: mouse at larry.mcrcim.mcgill.edu



More information about the Comp.lang.c mailing list