Copy strings with "strcpy", not an idiom
John Bruner
jdb at mordor.UUCP
Tue Mar 12 03:25:47 AEST 1985
The most portable, most readable, and often most efficient way
to copy strings is to use the string copying routines. Then
the implementation of "strcpy" can use the fastest approach
(which may even turn out to be inline code if your compiler is
smart enough). Attempting to save the procedure call overhead
by coding the string copy directly may be counterproductive
if you choose the wrong code sequence, or you forget to declare
your variables "register", or you move it from a VAX to a PDP-11
and there aren't enough register variables so they become "auto"
(substitute your favorite machines for "VAX" and "PDP-11"), or....
--
John Bruner (S-1 Project, Lawrence Livermore National Laboratory)
MILNET: jdb at mordor.ARPA [jdb at s1-c] (415) 422-0758
UUCP: ...!ucbvax!dual!mordor!jdb ...!decvax!decwrl!mordor!jdb
More information about the Comp.lang.c
mailing list