2 ms·
> The underlying cause is zero-terminated strings (instead of using start/end pairs or start/length pairs). What type (and how big) should length be?
by mrkeen 6y ago
> The underlying cause is zero-terminated strings (instead of using start/end pairs or start/length pairs).
What type (and how big) should length be?
- mikepurvis 6y agoProbably something like how msgpack (or even variable length unicode encoding) works, where the low 127 bytes is a single uint8 char in place, and then the next 121 signals that a string of length 1-121 bytes follows, and then after that are a handful of sentinel values for "length follows and it's 1/2/4/8 bytes" plus maybe some special cases like zero-length string. I can understand that this might have been too much implementation complexity/risk to contemplate 40 years ago, but this kind of pattern is very well established at this point, especially in scripting languages with loose typing.
- masklinn 6y ago> What type (and how big) should length be? size_t.