J
jacob navia
In this thread I present a version of the container library.
I would like to emphasize that this proposal has two facets:
(1) An INTERFACE for container objects
(2) A sample implementation of the interface
Note that the sample implementation's objective is to prove that the
interface is sound and give a means to test it. It can be used as a starting
point for more performant constructions, that keep the interface but
improve speed, memory footprint, etc.
The design decisions that go into the code of the sample implementation
are
(1) Keep the code as small and readable as possible
(2) Minimize memory footprint: single linked lists,
no allocation in prevision of further allocs, etc.
Nevertheless, the list code (as unoptimized as it is) is
approx 10-15% faster than fully optimized STL. This shows
the power of C and its potential.
The code defaults to:
NO_C99 for maximum portability
NO_GC for implementations that do not have a garbage collector.
You can change those values in the "containers.h" header
The code compiles cleanly with gcc (-O2 -Wall -pedantic)
and Microsoft MSVC. (I used 2005 but all other versions should
do). For UNIX users please -DUNIX to change the name of
stricmp to strcasecmp.
Thanks for your attention and I hope this time it is better than the
last time
jacob
I would like to emphasize that this proposal has two facets:
(1) An INTERFACE for container objects
(2) A sample implementation of the interface
Note that the sample implementation's objective is to prove that the
interface is sound and give a means to test it. It can be used as a starting
point for more performant constructions, that keep the interface but
improve speed, memory footprint, etc.
The design decisions that go into the code of the sample implementation
are
(1) Keep the code as small and readable as possible
(2) Minimize memory footprint: single linked lists,
no allocation in prevision of further allocs, etc.
Nevertheless, the list code (as unoptimized as it is) is
approx 10-15% faster than fully optimized STL. This shows
the power of C and its potential.
The code defaults to:
NO_C99 for maximum portability
NO_GC for implementations that do not have a garbage collector.
You can change those values in the "containers.h" header
The code compiles cleanly with gcc (-O2 -Wall -pedantic)
and Microsoft MSVC. (I used 2005 but all other versions should
do). For UNIX users please -DUNIX to change the name of
stricmp to strcasecmp.
Thanks for your attention and I hope this time it is better than the
last time
jacob