logoalt Hacker News

fsckboylast Friday at 10:38 PM1 replyview on HN

neat, i like it, has some of the same ideas i've used in my string packages

but i did see a place to shave a byte in the sds data struct. The null terminator is a wasted field, that byte (or int) should be used to store the amount of free space left in the buffer (as a proxy for strlen). When there is no space left in the buffer, the free space value will be.... a very convenient 0 heheh

hey, OP said he wants to be a better C programmer!


Replies

ranger_dangerlast Friday at 10:56 PM

> The null terminator is a wasted field

I think that would break its "Compatible with normal C string functions" feature.

show 1 reply