>>108899468
The problem with that is that it necessitates that the allocation of the string data itself is separate.
Sometimes that's nice, sometimes it isn't.
If I were to do it myself, I would do
struct string {
size_t len;
size_t capacity; // Optional; maybe as a separate string builder type
char data[];
};
struct string_view {
size_t len;
char *data;
};
But then I find all of this stuff overly tedious, and just throw char pointers around.