Few days ago I started organizing my code in a way that I wasnt very used to, but I liked it a lot, the problem is I dont know if its bad or if its good, I mean its working but I wonder if the code gets bigger it will eventually be problem. This how I'm doing with my code:
//just the functions part of the header, without includes and stuff
.h file
1 2 | void init(); void someFunction1(); |
.cpp file
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | struct myData { int someVar = 0; int someVar1 = 21; } myData* mydata = nullptr; void init() { mydata = new myData(); mydata->someVar = 1; } void someFunction1() { mydata->someVar = mydata->someVar1; } |
will I get errors or anything weird in the future using it like this?
also, putting "static" on the mydata pointer will make it better? or its just
better to put this struct and pointer on the .h file?