objects

objects in c
git clone https://noulin.net/git/objects.git
Log | Files | Refs | README | LICENSE

commit ba57aa378275c57e32349ccba6d9a5df411f21df
parent 304fe855da352322f2a5b5f949c9157ca2138fcd
Author: Remy Noulin (Spartatek) <remy.noulin@spartatek.se>
Date:   Thu, 23 Feb 2017 10:32:40 +0100

remove createO macros

It can't be generic because initiate depends on the object type.

main.c | 15 +--------------
1 file changed, 1 insertion(+), 14 deletions(-)

Diffstat:
Mmain.c | 15+--------------
1 file changed, 1 insertion(+), 14 deletions(-)

diff --git a/main.c b/main.c @@ -3,9 +3,6 @@ #include <string.h> // Generics -#define createO(type, obj) type obj; initiateclasst(&obj) -#define createAllocateO(type, obj) type *obj; initiateAllocateclasst(&obj) - #define deleteO(obj) obj->terminate(&obj) @@ -26,7 +23,6 @@ struct class { // Initiate/Terminate Objects #define createclasst(obj) classt obj; initiateclasst(&obj) #define createAllocateclasst(obj) classt *obj; initiateAllocateclasst(&obj) -// (use generics instead of these macros ^: createO and createAllocateO) void initiateclasst(classt *self); void terminateclasst(classt **self); @@ -78,14 +74,5 @@ void main() { classt *obj4; initiateAllocateclasst(&obj4); obj4->print(obj4, "\nOBJ 4\n"); - obj4->terminate(&obj4); - - // - - createO(classt, obj5); - obj5.print(&obj5, "\nRegular Object 5\n"); - - createAllocateO(classt, obj6); - obj6->print(obj6, "\nObject 6 in heap\n"); - deleteO(obj6); + deleteO(obj4); }