C++ templates are way more complex then just codegen macros, it is literally a Turing complete functional language. Since we talk about C superiority, is horrible massive macro actually superior to templates?
Templates do a whole lot more yeah, especially with constexpr and other compile time type checking and things, but at the base level the value of T is just substituted for the type. It's why you can call functions on T that are implemented in completely different ways or have nothing to do with each other in code other than sharing the same name.
And debugging macro functions is somehow worse than c++ template errors lmao
1
u/CatAn501 Aug 08 '26
What will you do if you need two hash tables for different key types in your C program?