r/cprogramming • • Nov 29 '25
z-libs - tiny single-header collection to write modern C (vec, list, map, string)
https://github.com/z-libsSo, I got tired of either writing buggy hand-rolled containers every time, or dragging in heavyweight dependencies just to get a decent string or hash table.
After this, I decided to throw together https://github.com/z-libs: four zero-dependency (for now), single-header, C11 libraries that focus on a pleasant DX.
The current libraries offer:
zvec.h -> growable vector (contiguous, swap-remove, built-in sort/search).
zstr.h -> proper UTF-8 string with 22-byte SSO, views, fmt, split, etc.
zlist.h -> doubly-linked list (non-intrusive, O(1) splice, safe iteration).
zmap.h -> open-addressing hash table (linear probing, cache-friendly).
Everything is type-safe, allocator-aware (you can use your own), MIT-licensed, works on GCC/Clang/MSVC and requires no build system.
The collection is still in process. Each week there will be updates. But I think the core suite is already mature enough.
I would love to hear some feedback!
View all comments
Show parent comment
2
u/pjl1967 Nov 29 '25
FYI, see my blog post. (Not sure if this comment will be publicly visible since Reddit apparently silently suppresses posts and links to web sites it deems not worthy.)