Show HN: Pottery – A header-only container and algorithm template library in C
github.com
github.com
Most container libraries in C are either weakly typed (with void pointers and function pointers) or they are heavy on macros (expanding to huge blocks of code wrapped in "do {} while(0)".) Pottery is different: it uses include files and renaming macros to create strongly typed composable templates. The templated code in Pottery looks sort of like normal C, and it preprocesses into ordinary C functions similar to what you would write by hand.
There's a bunch of stuff in the examples to demonstrate Pottery: a toy chess engine, yet another string library, etc. I'd love some feedback on it so please have a look or try it out and let me know what you think.
Thankfully it only affects the instantiation of the template. When you use the resulting code, it's only as verbose as your name for it. You can call, say, an int vector "iv"; the type will be iv_t and functions will be iv_init(), iv_destroy(), etc.
As for Pottery's internals, they're pretty verbose everywhere unfortunately. I did abbreviate a few things (like "open_hash_map" is "ohm" internally) but in the end I just decided to embrace the verbosity.