Hacker News new | ask | show | jobs
by Joker_vD 44 days ago
The language kinda forces one to use void pointers, as the path of the least resistance. I've seen your implementation of type-safe containers and it's a lot more effort (and requires rather recent version of C) than simply having a pointer-to-void as the payload.

Although GLib indeed has some rather weird design/taste.

> and why is it called gpointer?

    An untyped pointer, exactly equivalent to void*.

    The standard C void* type should usually be preferred in new code, but gpointer
    can be used in contexts where a type name must be a single word, such as in the
    GType name of G_TYPE_POINTER or when generating a family of function names for
    multiple types using macros.
Hey, they do have type-generating facilities! They just don't use them to template their containers. It's a very, very old library, it predates C99.
1 comments

BSD's generic macros are certainly older than C99 and I would not call this "a lot more effort". My macros are exploring a modern version of this, but people have been doing this for decades.