Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 8 years ago.
Improve this question
What are good libraries for C with datastructures like vectors, deques, stacks, hashmaps, treemaps, sets, etc.? Plain C, please, and platform-independent.
The Glib library used on the Gnome project may also be some use. Moreover it is pretty well tested.
IBM developer works has a good tutorial on its use: Manage C data using the GLib collections
As always, Google is your friend:
http://nixbit.com/cat/programming/libraries/c-generic-library/
specifically:
http://nixbit.com/cat/programming/libraries/generic-data-structures-library/
There's some stuff in the Apache Portable Runtime (APR) that I'd expect to be very solid.
Maybe http://sglib.sourceforge.net/ if you want an easy to use, very fast, macro based library.
If hash tables, extensible strings and dynamic vector are enough for your needs, please have a look at the library I put toghether: http://code.google.com/p/c-libutl/.
I also would welcome any feedback!
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
I've been looking for a small YAML/JSON parser, preferably a single-file solution, so i can easily embed it on my application. I'm looking for a small and simple solution since i intend to use it on different platforms, and building libyaml and other solutions will be a huge pain in the ass.
Also, is TinyXML a good alternative? What is fastest to parse?
I was looking for something similar sometime last year. This is the one I settled on:
YAJL
It's not a single file solution, but it's not very big either. I has some features like JSON formatting and syntax checking that you might see as feature bloat, but they don't bother me.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 8 years ago.
Improve this question
C++ has STL and Boost and C# has the .net Framework library. Similarly, what are the most common libraries useful to a C programmer? (Other than the C standard library.)
I am looking for most of the capabilities available in the STL: containers (vectors, linked lists, trees, hash table), algorithms (sorting, searching), file IO and strings.
Ideally, the library should be open-source, work on Windows (cross-platform is fine) and is being used actively.
If you want general-purpose data-structures like STL has, glib is probably the answer to your question. But a better question might be why are you writing your program in C? C's potential to shine comes when you don't use overly-general code to perform tasks that could be better performed in ways specific to your particular task at hand. glib just gives you "C++ with ugly syntax" (and less ability for the compiler to optimize).
The closest I know if is glib from GTK, see http://library.gnome.org/devel/glib/2.26/
Yes. GLib is the closest thing to STL in C. If you find it quite complex to use, try Vala. It is much easier. http://live.gnome.org/Vala
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 8 years ago.
Improve this question
I wonder if there is an alternative for the std::vector in C? I found this implementation but it seems to contain some issues with memory reallocation.
You can give glib and its arrays (GArray) a try.
glib is actively maintained, cross platform, open source (LGPLv2+), and it doesn't stop on arrays/vectors. You also have hash tables, linked lists, queues and many other data structures.
While reading C Array vs. C++ Vector, I found an interesting implementation of a simple vector container in C, which also includes push/pop operations. It's worth reading it!
If you focus is on mathematics you can work with GSL, there have a more bare bones math centric concept.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 8 years ago.
Improve this question
I'm thinking of something like glib, but possibly a slim version with a minimal foot print. It would need basic utilities such as linked lists, vectors and hash tables. It should also have a minimal runtime footprint.
Not exactly a library, but a tested, optimized and documented piece of code: sys/queue.h on *BSD and Linux systems has macros for various kinds of intrusive linked lists and queues.
uthash is a nice hash table library (made entirely of macros), it also comes with a linked list, dynamic string and dynamic array macros.
I also highly recommend sys/queue.h (suggested by larsmans) for simple and well tested linked lists.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
Hi I'd like to read good tutorials on setjmp/longjmp in C. It'd be better if there're examples which are real rather than artificial.
Thanks.
It's not really a tutorial as such, but the libpng documentation describes how the library uses setjmp/longjmp to do error handling.
The book "C interfaces and implementation" explains the concept well and implements a usable "exception" simulation in C using these constructs. The code for it (chapter 4) is freely available online here.
Edit: also see this SO thread
Then you should read Advanced Programming in the UNIX(R) Environment (2nd Edition) Here's the sample you're looking for http://my.safaribooksonline.com/0201433079/ch10lev1sec15 (just a preview)