3 ms·
These days if you write C you probably want to be in control of your allocations (and avoid as many as possible). At least that's what I do. There are no excus
by simias 13y ago
These days if you write C you probably want to be in control of your allocations (and avoid as many as possible). At least that's what I do.
There are no excuses for not including strl* functions in all standard C libraries, it's just NIH that causes the status quo.
strcpy and friends are broken because they are C string functions that can generate invalid C strings and fail the Principle of Least Astonishment. The strl* variants are safer, easier to debug (it's easier to catch a bogus truncation than a missing \0 that might still execute properly by chance on certain systems/builds but not others) and only requires a couple instructions on top of the existing string copy functions. I have yet to hear a reasonable argument about why they shouldn't be included (no, "horribly inefficient BSD crap" is not a reasonable argument).