3 ms·
I suppose, but watching everyone mess about with a struct that has length and a buffer, and a dearth of built-in functions to manipulate it, is...ugh.
by tyingq 7y ago
I suppose, but watching everyone mess about with a struct that has length and a buffer, and a dearth of built-in functions to manipulate it, is...ugh.
- tyingq 7y agoAn article with a better, and more dramatic explanation of the same opinion I have: https://queue.acm.org/detail.cfm?id=2010365 https://queue.acm.org/detail.cfm?id=2010365
- 59nadir 7y agohttps://github.com/antirez/sds https://github.com/antirez/sds is heaps better than just using raw strings. Any language with a fat pointer variant out of the box is going to do it better than C as well. That's not to say that the rest of C is bad, but there's nothing to be gained from defending C strings; they're bad and you should probably use an alternative and that alternative should probably have a length and a buffer, even better if you can find this out of the box in your language that otherwise works a lot like C.