Join Nostr
2025-07-13 08:48:42 UTC

Pat on Nostr: Length-prefixed strings (length + string) are so much nicer than null-terminated ...

Length-prefixed strings (length + string) are so much nicer than null-terminated (string + 0)

E.g, if I want to save my string to a binary file and read it again, I know immediately how much memory to allocate for it (rather than reading it once and backtracking)

Also removes all the unsafe str functions, by forcing the use of the strn functions as default

Perhaps a big issue is that a string is now sizeof(size_t) + sizeof(char*), rather than length + 1

I am open to counter arguments :)