Re:C Strings and my slow descent to madness
by mikewarot on Thursday April 06, 2023 @06:13PM
(#35475252)
Which is why Free Pascal strings are so awesome. I've personally stuffed a billion bytes on one, without issues. They are automatic reference counted, and as close to magic as you can get. You can return one from a function without issue.
However, Free Pascal has the worst documentation of any major project I've ever encountered (The exact opposite of Turbo Pascal), so I can't link to a good reference. Their Wiki is a black hole of nuance and sucks all useful stuff off the internet.
Re:C Strings and my slow descent to madness
by initplus on Thursday April 06, 2023 @06:21PM
(#35475322)
You can fix this issue by using a variable width integer encoding for the size.
Re:C Strings and my slow descent to madness
by burntsushi on Thursday April 06, 2023 @06:43PM
(#35475522)
It might fix that particular issue, but you still have the same problem that NUL terminated strings have: it's not possible to cheaply create views/slices of a string using the same type.
And the wheels fall off with the first string longer than 255 characters.