I have a file with several related functions which need to share a piece of data. While I would like to avoid the use of a global variable, The best solution I can think of is to declare a static in the file, but I’d like to restrict the scope to the file. I think that can be done with a static declaration. Are there other, superior alternatives?
In an object oriented environment, they would all be members of a class.
Nope, declaring a global static variable pretty much covers what you need to do (provided that the variable needs to change; otherwise, use a macro). You can declare a static variable at the global level and have it be private to the file.
Also, be aware that this is totally not threadsafe.