A modern C type-safe container library

,

What do you guys think about creating a modern(" " or “-” here)C data-structures oriented library similar to GLib? It would include intrusive lists konwn from Linux kernel (example implementation to follow – https://github.com/tidemmo/clist) and modern, type safe vector, not based on a void pointer to handle the data (like gptrarray), like for example https://github.com/graphitemaster/cvec or the one from https://github.com/tylov/STC. The library would be using _Generic (not intesively, modern techniques are what the most enable type-safe containers) and be mostly like CTL, ie. implementing lists, vecs, queues, sets, maps, etc.

I think that there is a strong demand for such library as the API of GLib 2 is now days pretty much old fashioned, not typesafe… :frowning: I think that GNOME organization behind it would be a strong motivation to use it, unlike the CTL or CList and other, where lack of such makes the decision of adding it to own project a big problem.

There is a similar “generic” array used inside GDK/GTK. You can also see some previous discussion here about adding a form of type safety to GArray. C _Generics are pretty limited and cannot really be used for OOP or dynamic typing though because the list of types is fixed there at the time of macro definition.

For intrusive collections I usually just use <sys/queue.h> and <sys/tree.h>.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.