Hi, I mentioned in one of my earlier questions that I'm reading book "C++ Coding Standards" By Herb Sutter and Andrei Alexandrescu. In one of the chapters they are saying something like this:
Always perform unmanaged resource acquisition, such as a new expression whose result is not immediately passed to a smart pointer constructor, in the constructor body and not in initializer lists.
Does that mean that I should use construction of this form (providing that data_3_ has to be initialized with new):
SomeClass(const T& value, const U& value2, const R& value3)
: data_(value), data_2_(value2)
{
data_3_ = new value3;
}
instead of:
SomeClass(const T& value, const U& value2, const R& value3)
: data_(value), data_2_(value2), data_3_(new value3)
// here data_3_ is initialized in ctor initialization list
// as far as I understand that incorrect way according to authors
{
}
Thanks in advance.
P.S. And if that's what they mean why are they using term unmanaged resource acquisition? I always thought that this resources are "manually managed"?
P.S 2. I'm sorry in advance if there are any formatting problems in this post - I have to admit - I absolutely detest the way of formatting on this forum.