Need card #406 · Relevance High · Status New

Type-safe generic containers in C

Updated 10/11/2026, 22:16:17

Problem

Developers lack built‑in generic type safety in C, forcing them to rely on macros or external tricks to create type‑safe generic containers, which reduces code readability, increases maintenance cost, and limits compile‑time checking.

Pain points

Questions to verify

Evidence

quote · @Anonymous
I don't understand people reinventing macro-based hacks in C to achieve what was achieved in other languages many years ago. Why not using C++, for example? It's available almost everywhere, introducing its usage in an existing C codebase is pretty simple. Sure, C++ has its own downsides, but is it better to create mess with macros in C rather then using exiting language facilities and standard library containers provided by C++?
quote · @Anonymous
Related. Others?I write type-safe generic data structures in C - https://news.ycombinator.com/item?id=44425461 - June 2025 (182 comments)Type-safe generic data structures in C - https://news.ycombinator.com/item?id=26735655 - April 2021 (52 comments)

Disclaimer: this card is distilled by AI from community discussions as “pain point evidence”. It is a starting point for need analysis and validation, not a “validated market need”. AI has analytical limits; please open the original discussion above to manually verify before key decisions.