[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Generic Data Structure Library in C



Kenneth Chin wrote:
> I've also written programs in C++ and Java, and both (STL in C++ and
> java.util.* in Java) have provided some fundamental and generic data
> structures for programmers like vectors and maps. Since a lot of
> programmers still develop software in C, I was thinking whether it is
> feasible and helpful to develop a STL-like library in C.

C is a very limited language for implementing ADTs like in STL. I've
had the same need too and I used publib which worked for me.
How about hacking that lib to add more functionality?

In brief, you can't have the STL iterators/allocators/... in C because
those are thought with the ability of C++ compiler to optimize out
most of the code ;) Neither you can have generic type-safe containers
because C isn't a generic language. You have to keep void* pointers
and node sizes, etc. The implementation should be more like java
containers rather than STL I guess.

Thanks,

-- 
Eray (exa) Ozkural
Comp. Sci. Dept., Bilkent University, Ankara
e-mail: erayo@cs.bilkent.edu.tr
www: http://www.cs.bilkent.edu.tr/~erayo



Reply to: