3 ms·
Putting a mutex around a global variable doesn't change the fact that it is still a global variable. Memory access might be safe but you get spaghetti code and
by Too 10y ago
Putting a mutex around a global variable doesn't change the fact that it is still a global variable.
Memory access might be safe but you get spaghetti code and combinatorial state explosion due to all the potential side effects.
Allowing singletons for edge cases is fine but with no proper way to enforce it except code review you really have now idea what the underlying code might potentially do.
- steveklabnik 10y agoI agree with you that using globals as sparingly as possible is good, but your original claim was about safety, so that's what I focused on.