I have to agree with @Carl Norum: there is nothing wrong with setting up the global configuration that you currently have. You say that everyone "got something." As you know, the problem with globals occurs when everyone writes to them. In your case, configuration information is really needed all over the world, so it deserves global.
If you want to make it a little more decoupled and protected - a little less global, then why not add some read / write access procedures.
You see, storing pointers everywhere will not solve the problem: it will add only a layer of indirection that simply masks or disguises what is actually global access that makes you nervous. And this extra layer of indirection will add enough space for juuuuust a little small mistake to sneak in.
So, the bottom line: if the material is natural global, make it global and donβt worry about the usual widespread wisdom, which is mostly correct, but may be wrong in your application. Always being bound by the rules / propaganda that CS professors expose is, imo, a perfect example of a dumb sequence.
source share