Re:Beware of strncpy and strncat
by MrBingley on Wednesday June 06, 2018 @02:04PM
(#17249465)
Looking at the comments in this post, I'm resigning myself that there simply is no correct solution for copying or concating strings in C. Null-terminated strings are a fundamentally broken concept. I think the long-term solution is simply to move to a different language (Rust, C++, D, Go, whatever) where we have the benefit of hindsight and have (pointer, length) string types, which solve all the problems null-terminated strings introduce.
[ Parent
| on HN ]
It's quite sad to behold how hard it is to work with strings in C.
All those functions seem broken by design, forcing the programmer to clean up their mess in edge cases.