by rocqua · 6y ago · 0 comments
At the same time, the standard implementation of strcpy is:
while((*dst++ = *src++));
which has a legitimate reason for doing assignment inside the while condition. Then again, one could argue that the above code is 'too clever'. And I would probably agree.Static analysis already has way too many false positives as it stands. For a well maintained code base the rate can easily be 100% false positives, which gets annoying after some time.
do {
*dst = *src;
*dst++;
*src++;
} while(*dst);The grandparent post's code is just nonsensical.
e: I submit my revised code:
do {
*dst = *src;
src++;
dst++;
} while(*(dst - 1));