Re: [QuantLib-svn] SF.net SVN: quantlib:[17110] trunk/QuantLib/ql/math/interpolations/ mixedinterpolation.hpp

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

Re: [QuantLib-svn] SF.net SVN: quantlib:[17110] trunk/QuantLib/ql/math/interpolations/ mixedinterpolation.hpp

Ferdinando M. Ametrano-3
On Wed, Feb 17, 2010 at 10:36 AM,  <[hidden email]> wrote:
> I have no idea what VC9 complains about, but the 'this->' is
> required by the C++ standard.

see Visual Studio Help below

ciao -- Nando

================================================

Error Message
'this' : used in base member initializer list


The this pointer is valid only within nonstatic member functions. It
cannot be used in the initializer list for a base class.

The base-class constructors and class member constructors are called
before this constructor. In effect, you've passed a pointer to an
unconstructed object to another constructor. If those other
constructors access any members or call member functions on this, the
result will be undefined. You should not use the this pointer until
all construction has completed.

This is a level-1 warning under Microsoft extensions (/Ze) and a
level-4 warning otherwise.

The following sample generates C4355:


// C4355.cpp
// compile with: /W1 /c
#include <tchar.h>

class CDerived;
class CBase {
public:
   CBase(CDerived *derived): m_pDerived(derived) {};
   ~CBase();
   virtual void function() = 0;

   CDerived * m_pDerived;
};

class CDerived : public CBase {
public:
   CDerived() : CBase(this) {};   // C4355 "this" used in derived c'tor
   virtual void function() {};
};

CBase::~CBase() {
   m_pDerived -> function();
}

int main() {
   CDerived myDerived;
}

------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
Reply | Threaded
Open this post in threaded view
|

Re: [QuantLib-svn] SF.net SVN: quantlib:[17110] trunk/QuantLib/ql/math/interpolations/ mixedinterpolation.hpp

Ferdinando M. Ametrano-3
On Thu, Feb 25, 2010 at 4:45 PM, Luigi Ballabio
<[hidden email]> wrote:
> You can remove the warning by removing
>
> xBegin2_(this->xBegin_+n)
>
> from the initializer list and adding
>
> xBegin2_ = this->xBegin_+n;
>
> to the body of the constructor.

done, thank you

ciao -- Nando

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev