3 ms·
I would not add common data structures or an interface for reference counting. C has no generics so there is no good way to implement these. You could use macro
by 7786655 6y ago
I would not add common data structures or an interface for reference counting. C has no generics so there is no good way to implement these. You could use macros, but that would be abominable. You could use void* , but that leaves a lot of performance on the table (see: qsort, bsearch).
What I would do is purge null-terminated strings from the standard library and use exclusively pointer-and-length strings. (const char * str, size_t str_len). That would be a massive improvement, especially to the IO library, which currently has to support both null-terminated strings and pointer-length strings (since only the latter allows binary IO).
The C locale library is really awful. printf() needs to have a way to choose between locale-dependent and locale-independent formats, and the latter should be the default.
strcmp(), strcpy(), and strcat() would all be gone because without null-terminated strings these can be replaced by memcmp() and memcpy().
It would also be nice if the IO library allowed creating memory-backed files, since this is a very common extension and would make FILE * more useful for defining APIs that take or output to streams.
Would add a standard interface for getting a directory listing.
Make char unsigned by default. (Currently it's implementation dependent, and usually signed, which is almost always incorrect).
And I would get rid of isupper() and other functions that can't handle multibyte characters.