On Apr 3, 2013, at 11:53 AM, Roy Stogner <royst...@ices.utexas.edu> wrote:
> > On Wed, 3 Apr 2013, Derek Gaston wrote: > >> I can't see how the container is not created yet... that would be a >> segfault when you try to push_back on it.... > > No, that would be undefined behavior when you try to push_back on it. > "undefined behavior" only means a segfault when it ends up hitting > memory outside the process' current address space. > >> not too mention that the code that actually does the pushing back is >> in Singleton.C which is where the container is... so it would have >> had to have been created by the time you call that function... > > Doesn't matter. > > What C++ is doing under the hood is: > > Construct A > Construct B > > except in random order (which is why stuff worked fine for Ben), not > alphabetical order. > > And if A's constructor calls a function dealing with B, there's > neither compile-time nor run-time analysis done to detect that and say > "whoops, let's construct B before A". I'm having a hard time visualizing that, but if that is indeed the issue shouldn't it suffice to move SetupList setup_cache; from the anonymous namespace instead into a static member of the Setup::Setup() constructor? That will guarantee it is not instantiated until it is first called, and that it will be there when needed. -Ben ------------------------------------------------------------------------------ Minimize network downtime and maximize team effectiveness. Reduce network management and security costs.Learn how to hire the most talented Cisco Certified professionals. Visit the Employer Resources Portal http://www.cisco.com/web/learning/employer_resources/index.html _______________________________________________ Libmesh-devel mailing list Libmesh-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libmesh-devel