Re: C++ help needed: singleton.hpp

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: C++ help needed: singleton.hpp

Klaus Spanderen-2
Hi

I'm having this problem using Visual Studio Express 2005.

I nailed it down to a 15 line program (attached to this email), which
generates to wrong results when compiled within a separate Visual Studio
solution _and_ the option

Common Language Runtime-Support (/clr)

is switched on. Everything is okay as soon as I'm switching this option off or
declaring

inline T& Singleton<T>::instance() { ..}

instead of

T& Singleton<T>::instance() { }


cheers

--
Klaus Spanderen
Ludwig Erhard Str. 12
48734 Reken (Germany)
EMail: [hidden email] (remove NOSPAM from the address)

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev

EquityOption.cpp (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: C++ help needed: singleton.hpp

Luigi Ballabio

On Sun, 2007-10-14 at 09:41 +0200, Klaus Spanderen wrote:
> I'm having this problem using Visual Studio Express 2005.
>
> I nailed it down to a 15 line program (attached to this email), which
> generates to wrong results when compiled within a separate Visual Studio
> solution _and_ the option
>
> Common Language Runtime-Support (/clr)
>
> is switched on.

Hmm. We might use the preprocessor to define the inline declaration
conditional to that particular compiler and option---I'd like to keep it
non-inline when possible, since inlining it might give problems on other
compilers. What do you think?

Later,
        Luigi


--

There is no such thing as public opinion. There is only published
opinion.
-- Winston Churchill



-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
Reply | Threaded
Open this post in threaded view
|

Re: C++ help needed: singleton.hpp

Luigi Ballabio
In reply to this post by Klaus Spanderen-2
On Sun, 2007-10-14 at 09:41 +0200, Klaus Spanderen wrote:

> I'm having this problem using Visual Studio Express 2005 [...]
> when compiled within a separate Visual Studio
> solution _and_ the option
>
> Common Language Runtime-Support (/clr)
>
> is switched on. Everything is okay as soon as I'm switching this option off or
> declaring
>
> inline T& Singleton<T>::instance() { ..}

Klaus,
        I've committed a fix. May you try it and see if it works?

Thanks,
        Luigi


--

There is no such thing as public opinion. There is only published
opinion.
-- Winston Churchill



-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
Reply | Threaded
Open this post in threaded view
|

Re: C++ help needed: singleton.hpp

Klaus Spanderen-2
Hi Luigi

you solved it, thanks!

Klaus


On Tuesday 20 November 2007 16:11:03 Luigi Ballabio wrote:

> On Sun, 2007-10-14 at 09:41 +0200, Klaus Spanderen wrote:
> > I'm having this problem using Visual Studio Express 2005 [...]
> > when compiled within a separate Visual Studio
> > solution _and_ the option
> >
> > Common Language Runtime-Support (/clr)
> >
> > is switched on. Everything is okay as soon as I'm switching this option
> > off or declaring
> >
> > inline T& Singleton<T>::instance() { ..}
>
> Klaus,
> I've committed a fix. May you try it and see if it works?
>
> Thanks,
> Luigi



--
Klaus Spanderen
Ludwig Erhard Str. 12
48734 Reken (Germany)
EMail: [hidden email] (remove NOSPAM from the address)

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev