Is it redundant to initialize global variables on startup?

Since Midi Translator initializes all global variables to zero on startup, does it make sense to initialize the ones in use by my project (other than the ones that need to have a non-zero value)?


You don’t need to set them but it is a good practice to at least document them in a single location. I generally do this by setting them and putting in comments what they are for on a translator I call “Init Global Variables”. In that translator I use Init timer as input. I also have another translator that monitors for my escape key that triggers the Init timer. I use that to put my project into a “known” state if I need to after the project has started.


Hi Steve,
Thanks for the reply. I wish I had done that at the start of my project. It would probably even be a good idea to do it now that I’m close to the end of coding, but time will tell if I have the gumption to really do it.
As for putting the variables into a known state after the project has been started, I’ve been doing that by doing “Restart Project” (in the file menu). Is there any difference?
I owe you a posting about MIDIBuddy. I’m using it, but find that, for my purpose, it’s best to deactivate and reactivate the presets that actualize MIDIBuddy commands using the functions provided by MT function. The Ctrl Alt R and Ctrl Alt P functions do work, but got me into difficulties when my code needed to send Ctrl, and in other situations as well, I think. I’m just pushing ahead with my coding…not looking left or right, but just intent on getting it done. After that I’ll have time to make a full report on how MIDIBuddy works best for me.

Yes, you can just restart the project on the system as well. I just find the ESC key quicker. Sometimes I even restart the project using incoming MIDI from an external controller. This is handy when my project is running on BomeBox which has no keyboard.
P.S. Not doing too much with MIDIBuddy lately, but I have a growing list of things I’m thinking about. I plan on not doing too much more unless I get more interest and/or user requests.