by aidenn0 · 7y ago · 0 comments
> Normally dynamic string libraries for C are implemented using a structure that defines the string. The structure has a pointer field that is managed by the string function, so it looks like this:
struct yourAverageStringLibrary {
char *buf;
size_t len;
... possibly more fields here ...
};
> SDS strings as already mentioned don't follow this schema, and are instead a single allocation with a prefix that lives before the address actually returned for the string.