Re: fix for intel's compiler

Posted by Kakhkhor Abdijalilov on
URL: http://quantlib.414.s1.nabble.com/fix-for-intel-s-compiler-tp9222p9226.html

I think it is broken just like the design using scoped_ptr or the
original design. Consider what happens when Singleton's instance is
used in two implementation files.

// file1.cpp
namespace {
    SingletonObject* const ptr = &SingletonObject::instance();
}

// file2.cpp
namespace {
    SingletonObject* const ptr = &SingletonObject::instance();
}

Who get's to build the singleton?

The only way to avoid this problem is to make the instance itself a
static local and forget about session ID. Each session would have to
reset the singleton, if needed.

A half-solution is to make sure that no instance is crated before
main() is launched. That means no static objects using singleton.

Which way we go?

------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev