cakelab
Home Projects Research Misc. Contact

C Template Library

[homac, 23.08.2009]

This project is a proof of concept. The question was, if it is possible to provide templates like those in the STL for C programming by the use of macros. And the answer is: yes. The given implementation of a linked list is such a template based on macros. There are two macros which take a name for the parameterised instance of the "template" and a type for the values handled with the list. The name is a scope for the set of data structures and functions for this particularly typed list like the class name in c++.

The first macro is used to declare the set of data structures and functions in a header file. The second macro covers the definitions of the functions to be used in a .c file. Look into the example in the directory test/list for more details.

Download