4 ms·
> although I couldn't think of a reason why One I've seen in the wild is an encoded data structure, a blob of null terminated strings passed around together.
by Cogito 7y ago
> although I couldn't think of a reason why
One I've seen in the wild is an encoded data structure, a blob of null terminated strings passed around together.
- kstenerud 7y ago... in which case you're conceptually dealing with a structure, not a string.
- Cogito 7y agoSure, once you’ve unpacked it into a structure. It’s used for sending stuff over the wire, but also for storing on disk etc. Conceptually it was dealt with as one string, which happened to contain nulls.
- kstenerud 7y agoYou'd be better off encoding it using ETB (end of transmision block). That's what the control code was designed for.
- Cogito 7y agoI can’t really speak to the why. In any case. I remembered seeing nul in strings in git, not sure if the same place (maybe?) but a quick search shows up some real world usages https://github.com/git/git/search?q=nul https://github.com/git/git/search?q=nul