Hacker News new | ask | show | jobs
by sirmiller 3775 days ago
The premise is wrong: "constructing a larger string out of multiple smaller strings is a pretty common programming task"

No, it's not.

"strcat(strcat(strcat(strcpy(buf, "This "),"is "),"a long "),"string.");"

Just checked 20 years of C/C++ repositories ... not a single strcat. Actually I can't remember ever using c-strings for more than args parsing or debug logging.

1 comments

I just did a quick GitHub search, strcat seems to have been used about 5 million times across all repositories, as compared to (e.g.) memcpy at about 80 million. Clearly somebody is using it. I would hate to try to get a measure of how often it's used in other languages; it's not the sort of thing anyone would think twice about. I believe you have made an inductive error based on your own sample and that the original premise is entirely correct.