String copy idiom.
Alan T. Bowler [SDG]
atbowler at watmath.UUCP
Tue Mar 12 11:20:37 AEST 1985
Actually my favourite string copy idiom is
strcpy(s, t);
On most machines this generates a smaller sequence, and I can frequently
count on the C implementor having supplied a code sequence,
(possibly written in assembler) that has been optimized for the particular
machine. At worst if performance is a real problem, and the implementor
didn't, I can write my own assembler routine once for this machine,
rather than having to find all the places I coded my own string copy.
On most large machines I know there are character vector instructions
that will allow implementation of a string copy that is faster than
any sequence I can code in C.
More information about the Comp.lang.c
mailing list