Is there any standardized and commonly-used library for C (C99 or whatever), as STL is for C++? [duplicate]
Possible Duplicate:
Container Class / Library for C
I expect I'd be forced to use vectors, lists and sets for my C progra开发者_运维问答m. Should I invent those entities from scratch, or there is some kind of standard library for C as STL is for C++ ?
C doesn't have templates, so it might be difficult to implement those C++ collections in a generic way. I'm not aware of any libraries that implement those features in C.
If I were faced with such a situation, my first thought would be to isolate the parts
of my program that would benefit from C++ features, write them in C++, then provide
an extern "C"
interface to those modules so they could be called from the pure C
parts of the program. Is that an option for you?
You can look at APR, or GLib. Those are widely used portable C libraries with everything you need not to reinvent the wheel each time.
There is a standard c library, but it does not have any support for built-in container types such as the ones you list.
精彩评论