4 ms·
It probably shouldn’t involve writing your own string functions. They’re so hard to get right, obviously. Last time I wrote C, I copied out the Rust Vec and Str
by cormacrelf 6y ago
It probably shouldn’t involve writing your own string functions. They’re so hard to get right, obviously. Last time I wrote C, I copied out the Rust Vec and String API as C headers and didn’t quite nail the implementation, but it was fun.
There are at least a few libs like sds that store the length information in various ways, which solves at least this kind of problem.
https://github.com/antirez/sds https://github.com/antirez/sds