简体   繁体   中英

Standard data structure library in C?

I am looking for standard tried and tested library in C language (Windows platform) which implements data structures like stacks, queues, trees etc.

I would prefer to have a source code along with it. Writing a library on my own is possible; however, I feel it may be better to opt for some industry standard implementation which may be optimised and less buggy.

Compiler is Visual Studio 2005/2008.

Glib

Download Glib for Windows here

  • GDSL . As per the documents, it is pure ANSI C and should work with Visual C++.
  • C-generic-library
  • Kompimi . C data structure library, with an emphasis on collections. Comes with Visual Studio project files.

Check out cbase . Its LGPL (most of the other libraries are GPL) if license is something that concerns you.

My only comment is that it requires C99 or GCC. It uses variadic macros, which aren't C89 compatible. It should compile fine under VC2005/2008.

cbase is a C library of useful functions that simplify systems software development on System V UNIX. The library includes routines for memory management, string parsing, filesystem traversal, subprocess execution, I/O, as well as implementations of common data structures such as linked lists, hash tables, stacks, and queues. The library also includes a high-level interface to Berkeley sockets, and an implementation of a scheduler which has functionality very similar to that of the cron daemon. Note: cbase was formerly known as CFL.

Have you checked out qLibc? It's an opensource C implementation that provides various types of data strucutre such as hash table, linked list, queue, stack...

As of today, from it's website I see it has following feature set:

  • Containers
    • List --- Doubly Linked List.
    • List Table --- KEY/VALUE paired table implemented on linked-list.
    • Hash Table --- Hash based KEY/VALUE paired table.
    • Static Hash Table --- Static(array/mmapped/shared) memory based KEY/VALUE paired table.
    • Vector --- implements a growable array of elements.
    • Queue --- FIFO(First In First Out) implementation.
    • Stack --- LIFO(Last In First Out) implementation.
  • General utilities.
    • String
    • I/O
    • File
    • IPC, Semaphore Shared-memory
    • En/decoders
    • Hashes
    • System
    • Time
  • Extensions
    • INI-style Configuration File Parser.
    • Apache-style Configuration File Parser.
    • Rotating File Logger.
    • HTTP client.
    • Database(MySQL) interface.

In each container implementation, it clearly explains internal data structure at the top of code. So it would be helpful for you to catch the implementation ideas.

The code can be found at https://github.com/wolkykim/qlibc

Hope this helps. (Please do vote if this helps, I need some points. Thanks :)

你可能想看看http://www.liblfds.org/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM