|
Re: Using shared variables instead of global variables
My previous post was open in my editor for quite awhile, so was largely redundant by the time I pressed the button.
Responding to your newer post, I think it will help if you can put the inputs to a state machine into a cluster. Put the outputs into a cluster as well. This will probably cut down by a factor of eight to ten.
In some code I've done that sounds similar, I also moved most of these globals into what we call a functional global. This is sometimes called a LV2 style global. It is a function with state data that has operations such as read and write, but sometimes read/and/clear, or append and remove. Anyway, these functions are often a good way to clean up scattered sets of globals into a small intelligent object that stores the data and makes access safe for a parallel language.
Greg McKaskle
|