A library to make dynamic memory management easier in C
A library to make dynamic memory management easier in C
As stated above, this is a library and does nothing useful on its own. The goals of this project are two fold:
This library adds the ability to create, destroy, and manage objects in C. Every object has a allocator, constructor, copy constructor, destructor, and deallocator. These operations form the basis of an objects life cycle, implicitly creating a memory management system.
Other features of the pseudo OO system are:
int
is still just an int
. See BasicTypeDemo
in the examples folder for more details.A library to make dynamic memory management easier in C
As stated above, this is a library and does nothing usefull on its own. Its main purpose is for easy creation of collections in C. The following collections are provided by this library:
Built ontop of each of these generic structres are the below non-generic collections. These are an example of how to extend the above generic representations. You can create more non-generic collections as necessary.
The code in this repository is orginized in a sudo OOP way. A class structure is defined in tandem with an object structure to form the basis of the OO model. There is a very clear template for defining a class and its associated object structure that is shown in every source file.
This is not a full OO system, advanced features like inheritance and method overloading are not supported. (Do note that composition is supported)
Building the program is easy, just run the below command in the same directory as all of the source files.
gcc -Wpointer-arith -Wall -o bin/main.exe debug/*.h debug/*.c src/*
When run the only thing executed is the debug operations. The output of the debug operations is shown below. If there are any errors, the text in the bracket will say ‘Error’ not ‘Ok’
./main
[Ok ]: 'File' class
[Ok ]: 'GenericList' class
[Ok ]: 'GenericLinkedList' class
[Ok ]: 'GenericDictionary' class
[Ok ]: 'GenericTree' class
[Ok ]: 'IntList' class
[Ok ]: 'String' class
[Ok ]: 'StringList' class
[Ok ]: 'StrStrDictionary' class
[Ok ]: 'XMLTag' class
[Ok ]: 'XMLFile' class