we can already emulate this by using "struct T" (for some struct type T that is never defined), with the unfortunate caveat that you have to convert pointers to struct T manually to/from the types you actually want, and there's no type safety. i want type safety.
Posts
-
wish C had generics -
wish C had genericsbut really i don't think it's a huge stretch to add some kind of type polymorphism to C ... the biggest question would be how to handle representation differences between types, and I think the simplest solution would be to treat generic types like an unknown/incomplete type. so generic code can't assume a size/alignment, but it can handle them using pointers, and/or use them as the last field in a struct.
-
wish C had genericsor absent a general solution ... wish C had a generic vector type.
-
wish C had genericswish C had generics