4 ms·
Considering that vector, map, etc are widely used and expected features of software development, I would think that good libraries in C exist for these already,
by hellofunk 11y ago
Considering that vector, map, etc are widely used and expected features of software development, I would think that good libraries in C exist for these already, so you don't have to even write your own 100 lines. Are there any?
- typedef_struct 11y agohttp://troydhanson.github.io/uthash/ http://troydhanson.github.io/uthash/
- a3n 11y agoThis is one of the reasons why every time I get nostalgic about C I then immediately get depressed. Having to find the next level of functionality, libraries, all over the internet, just makes my brain turn to peanut butter. I think this is one of the biggest disadvantage of a mostly standards based, no particular organization in charge type of language like C, as opposed to, say, python. I am fortunate that, at the moment, my needs are mostly casual and very rarely performance focused. If I needed C I would just STFU and use C, accumulating my own workarounds for the dispersed nature of its resources.
- lobster_johnson 11y agoGLib (not to be confused with glibc) from the GNOME project has a wide range of functionality -- generic lists, hash tables, strings etc.: https://en.m.wikipedia.org/wiki/GLib https://en.m.wikipedia.org/wiki/GLib Qt, I believe, also comes with a bunch of "standard library" stuff unrelated to UIs.
- hellofunk 11y agoBut Qt is all c++, no?
- unscaled 11y agoYes, GLib basically implements its own full-fledged OOP system on top of C. At which point, you start asking yourself, why are you not using C++? In my experience, most of the people who say they don't need OOP or generics end up implementing a limited (or even a full-fledged) version of these things themselves.
- ArkyBeagle 11y agoHashmaps to the side ( that's more challenging in 'C' and one really compelling feature of C++ ) the rest can frequently be "faked" with arrays. Obviously, scale matters - having fifteen "vector" implementations in a given system means a little bit of library-ness is in order. Much also depend on how much you really need dynamic allocation - it can be optional.