(http://blog.liw.fi/posts/strncpy/ is my rant about this. Others have made the point better, of course.)
(http://blog.liw.fi/posts/strncpy/ is my rant about this. Others have made the point better, of course.)
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).
std::string