| ??? 01/28/05 18:56 Read: times |
#86044 - Correct comments :-) Responding to: ???'s previous message |
Erik Malund said:
The following function copies a zero-terminated string pointed by *src into *dest
*/
void strcpy(char *dest, char *src)
{
while (1) // infinite loop begins
{
*dest = *src; // copy one character from *dest to *src
if (*dest == ' ') // if the copied character is zero
return; // abort the loop and return
++dest; // increment destination pointer
++src; // increment source pointer
}
}
copy one character from *dest to *src is not a comment, it an "explanation of compiler behaviour" just like the frequently seen PUSH ACC; save accumulator on stack is explaining an instruction, not its purpuse. Actually, it doesn't even explain the compiler behaviour. My compiler would copy FROM the *src TO the *dest. |



