CompuServe Messages

#lattice C

#: 117272 S10/ProgrammingForum unknown
    03-Apr-88 15:21:22
Sb: #117240-#lattice C
Fm: Bob Rakosky 75156,336
To: Steve Ahlstrom 76703,2006

This message turned up in search, but its forum couldn’t be identified from the original transcript, so it may not be linked into its thread.

>If you want to settle for slow, use strcpy! I'll stick with movmem I don't understand why strcpy is slower than movmem (at least to the noticible range – I don't want to count cycles, but they'd be close). At least with Lattice 4.0, both of these are 'builtin' functions that generate similar inline loops to perform the moves. Strcpy is definitely more 'friendly' when using strings, since the programmer doesn't have to count the number of characters in the source string (and remember to add 1 to insure that the terminating null was copied). And the 'right' way to count the length of the source string is to use the strlen() function, which will then increase the time taken / instructions executed to perform the move. movmem() will work (with the above caveat), but strcpy() is definitely a better choice unless the source field is not known to be a null-terminated string.