News for hackers. Stuff that matters.
Re:Fuchsia is not Linux by 72deluxe on Thursday April 12, 2018 @04:50AM (#16819076)
How is this an actual problem in the real world?
Re:Fuchsia is not Linux by jmaygarden on Thursday April 12, 2018 @09:05AM (#16820459)
If one isn’t careful, you end up with interdependency between static initializers. Since the order of static initialization is undefined, you get fun bugs like your program crashing because a minor change caused the objects to link in a different order.

For example, the dreaded singleton using a static variable inside a function:

    Singleton& get_singleton() {
        static Singleton instance;
        return instance;
    }
Having a couple of those referenced in static initializers is a recipe for disaster. It’s a bad practice, but people unfortunately do it all the time. Those that do this are equally unequipped to realize why their program suddenly started crashing after an innocuous change.
Re:Fuchsia is not Linux by jensa1948 on Thursday April 12, 2018 @09:58AM (#16820947)
People who use singletons deserve no better...