> C is valuable because it’s simple This is funny to me because just today some friends gave me a link to a C quiz: https://stefansf.de/c-quiz/ From which I gathered that it is a much more cursed language than I remembered. Maybe we all just got used to C and just happen to use a minimal subset. The problems with C are not mainly with the standard library, but any effort to improve things should be lauded.
There's C the standard, and there's C the implementation (compiler & platform). The standard is nice to have on a bookshelf, but your main reference should be the implementation.
sp.h: Fixing C by giving it a high quality, ultra portable standard library
221–222 of 222 posts
Re: sp.h: Fixing C by giving it a high quality, ultra portable standard library
#222Earlier quoted context omitted.
Nothing prevents you from using a shared pool of strings that don't have null terminator. It can even be more efficient, since you don't have the null byte to handle at string end. Depending on the maximum string length you want to support, it doesn't even have to take more space.
How do you represent that pool of strings on-disk? If we concatenate the raw strings together without the null terminator, either all string references will require a length on top of the offset (25% size penalty for a Elf32_Sym ), or we'll need a separate descriptor table that stores string offsets and lengths to index into. If we prepend strings with a length (let's say LEB128), we'll be at best tied with null-term…