If I'm using a singleton pattern (yeah, I know - they're usually bad)... and I had an instance function like so:
MySingleton* Instance() {
static MySingleton instance;
return &instance;
}
what storage class is instance?
I'm reading "Programming With POSIX Threads by David R. Butenhof", and I came across text that said:
Most of the time you'll probably declare condition variables using the extern or static storage class at file scope, that is, outside of any function. They should have normal (extern) storage class if they are used by other files, or static storage class if they are used only within the file that declares the variable.
Since this static is inside a function, is it auto? or is the class different because of the static key word?
If I moved the 'instance' variable to be static and global (not in any function) in its file - could I still give a reference to it to another file, or would that not work?