I'm kind of a beginner, and I have gone off written a 10000 line program which mostly uses globals and void functions, in c++.
Anyways, my program doesn't have a GUI, so I am making one for it using Clutter. So in clutter, you use a signal handling function to connect button clicks, motion events, etc.
The signal handling function can only accept one user data parameter. However, many components of the GUI, hundreds need to be accessed by different functions. So I'm putting all my GUI objects in a single struct, and passing it from every signal handling function.
So my program as it is now, (console program) prints press some letter to do something. If you press that letter, launch a certain function. If I eliminate the use of global, I would need to pass as parameters some of these variables.
If I directly insert my code into the GUI, then the signal handler function will launch the appropriate functions, but can only pass a single user data parameter, which as it is now, is already used as a struct with hundreds of GUI members.
Sorry If this all sounds crazy. I'm just trying to re-write my code to use better practices, but with the 10000 long code, and my lack of understanding of some things, I feel pretty overwhelmed.
I'm just looking for some advice about where to start and how to deal with this issue I am perceiving with connecting to the GUI.
And for my question about structs. I am interested in knowing if there is a maximum number of elements that can be inside a struct. If you have an array inside struct, is the access time for that array going to be slower? Is there a difference in how memory is handled for a struct.
Thanks.