Re: Rif: Re: C++ Problems

Posted by Michele Ravani-2 on
URL: http://quantlib.414.s1.nabble.com/Rif-Re-C-Problems-tp2461p2462.html

If I remember my C++ (it was years ago, therefore stupidity warning
applies for the following) throwing exceptions in a ctor is (or was)
considered problematic. I can't remember if the application behaviour is
undefined or at least compiler dependent if the constructor doesn't finish.
 
In any case, Stroustrup (third, p.367) mentions that C++ won't call the
dtor of an object which isn't completely constructed, so that you may land
with a leak, depending on how your ctor is implemented.

Having the ctor calling an initialization method is considered safer.

I hope my memory didn't fail me.

--
Michele Ravani                  [hidden email]
"Those who live hoping, die singing" My Gran