Recently a fellow worker showed to me a code like this:
void SomeClass::function() { static bool init = false; if (!init) { // hundreds
Think multi-threading. This type of code is problematic when function() can be called concurrently by multiple threads. Without locking, you're open to race conditions; with locking, concurrency can suffer for no real gain.
function()