Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/5/84; site mordor.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!genrad!panda!talcott!harvard!seismo!umcp-cs!gymble!lll-crg!dual!mordor!jdb From: jdb@mordor.UUCP (John Bruner) Newsgroups: net.lang.c Subject: Copy strings with "strcpy", not an idiom Message-ID: <1040@mordor.UUCP> Date: Mon, 11-Mar-85 12:25:47 EST Article-I.D.: mordor.1040 Posted: Mon Mar 11 12:25:47 1985 Date-Received: Thu, 14-Mar-85 04:42:58 EST References: <7042@watdaisy.UUCP> <7044@watdaisy.UUCP> Distribution: net Organization: S-1 Project, LLNL Lines: 14 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@mordor.ARPA [jdb@s1-c] (415) 422-0758 UUCP: ...!ucbvax!dual!mordor!jdb ...!decvax!decwrl!mordor!jdb