Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

We've been considering proposals to add common POSIX APIs into C, but I don't believe we've seen a proposal for strlcpy or strlcat yet. I recall we agreed to add strdup to C given its wide availability and usage.


There are deficiencies in almost all proposals. Two new functions which avoid the problems are supposed to be published in C202x: strcasecmp and strncasecmp, added in header strings.h (note: not string.h).


strdup seems like a perfect example of "standardizing existing practice." And it has never struck me as running against the spirit of C.


In fact I proposed strdup on a few occasions, but it wasn't adopted. It seems that they didn't like for standard library functions to use malloc. POSIX.1 specifies strdup.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: