More on strcpy()

Karl Heuer karl at haddock.ISC.COM
Fri Apr 15 04:22:17 AEST 1988


In article <904 at mit-caf.UUCP> vlcek at mit-caf.UUCP (Jim Vlcek) writes:
>Why not define strcpy() such that the destination is guaranteed to be
>equivalent to the original (before the move) source string?

Because, in order for this to work on both strcpy(s,s+1) and strcpy(s+1,s),
the implementation has to do extra work to guarantee nondestructiveness.  If
strcpy is being inline-expanded by the compiler, this can be a significant
overhead which is seldom necessary.

Karl W. Z. Heuer (ima!haddock!karl or karl at haddock.isc.com), The Walking Lint



More information about the Comp.lang.c mailing list