5 ms·
I think it is good if everybody implements their own string library. It builds character and you learn something from it. It is a rite of passage. However, d
by fefe23 6y ago
I think it is good if everybody implements their own string library.
It builds character and you learn something from it.
It is a rite of passage.
However, don't add to the pile of dependency hell that is already plaguing many open source projects. If you feel uneasy with how C strings work, consider switching programming languages instead. You will probably have an easier time and there will be less unmaintained incompatible string libraries rotting around on github.
- pengaru 6y ago> However, don't add to the pile of dependency hell that is already plaguing many open source projects If you create small libraries that don't produce shared objects intended to stand on their own with a stable API/ABI, but are simply headers or at most produce a .a from source fully intended to become vendored in-tree, you're not contributing to "dependency hell".
- rossmohax 6y agoIn theory this vendored library might show up multiple times in a dependency tree and be incompatible with each other.
- pengaru 6y agoIt's hardly a "dependency hell" when it only affects developers, in what are essentially unique collision type situations, and are generally addressable by the developer because the source is all present. And upstream maintainers of such intended-to-be-vendored code should generally be receptive to improving compatibility and build system configurability for such situations. And if they're not receptive/it's abandonware, congratulations your vendored library is now a fork and fix it yourself. When we refer to "dependency hell", AIUI, it's in reference to unresolvable runtime dependencies creating hell for end-users.
- dvfjsdhgfv 6y ago> I think it is good if everybody implements their own string library. ...until you someone exploits the bugs in it. Everyone who did the exercises in K&R should be able to write their own string library, probably with less bugs than the standard one. However, I really feel it's much better for everyone to use proven code like bstring.
- saagarjha 6y ago> probably with less bugs than the standard one Fewer bugs than what “standard one”?
- dvfjsdhgfv 6y agoWhatever implements string.h on your system, and other functions dealing with string input. Some of these functions simply shouldn't be used at all. An extreme case is gets() that was phased out, but many others are no better.
- saagarjha 6y agoThe string functions in your system are almost certainly less buggy than anything you’re going to write.
- dvfjsdhgfv 6y agoYou're kidding, right? We're not talking about the implementation, but the design. If I ever wanted to write a gets() replacement, it would definitely have proper checks in place to prevent buffer overflow. Everyone using strcpy() is playing with fire. You'll get it right 9 times and make a mistake the 10th time. It's not that the people who implemented these functions are stupid, but they were designed in different times for other types of environments.
- creata 6y ago> probably with less bugs than the standard one… We're not talking about the implementation, but the design. That's not how most people use the word "bug".
- paledot 6y ago> It builds character That's awful and I love it.