Could you recommend a good general purpose data container library for C (pure C, not C++)? I just need basic structures, like dynamic arrays, hash tables, etc.
(Note: By "good" I mean fast + elegant interface).
Could you recommend a good general purpose data container library for C (pure C, not C++)? I just need basic structures, like dynamic arrays, hash tables, etc.
(Note: By "good" I mean fast + elegant interface).
Isn't Glib sufficient for your needs ? :-) Glib link to what it provides
You might also want to check out the iMatix SFL, to quote their webpage:
The SFL (Standard Function Library) from iMatix is a portable function library for C/C++ programs. The SFL is the result of many years' development, and is provided as Open Source software for the benefit of the Internet community. The SFL is written in ANSI C and has been ported to MS-DOS, Windows, OS/2, Linux and other UNIX systems (IBM AIX, SunOS, HP/UX, Solaris, NetBSD, FreeBSD, SCO OpenServer,> Digital UNIX) and Digital OpenVMS. It comes with complete sources and documentation in HTML.
The SFL provides about 450 functions that cover these areas:
- Compression, encryption, and encoding;
- Datatype conversion and formatting;
- Dates, times, and calendars;
- Directory and environment access;
- User and process groups;
- Inverted bitmap indices;
- Symbol tables;
- Error message files;
- Configuration files;
- String manipulation and searching;
- File access;
- Internet socket access;
- Internet programming (MIME, CGI);
- SMTP (e-mail) access;
- Server (batch) programming;
- Program tracing.
The SFL is free software that you may use and distribute for private or commercial purposes according to the SFL License Agreement.
More details about the API itself, see here.
I think Dave Hanson's C Interfaces and Implementations qualifies as both fast and elegant. It includes many different kinds of containers, some string processing, multiprecision arithmetic, exceptions, a couple of different memory managers. Nice stuff.
There's a book, but you don't need to buy it to use the software.
I recommend MemSL. I used the library when implementing an x86 kernel, and I found it to be general, reliable, and bug free.
From the description: C Overview of the Memory Structures Library (MemSL)
The Memory Structures Library, MemSL for short, is a library of useful routines allowing the efficient use of complex data structures in C. The MemSL contains routines for managing: