Re:Why do C++ folks make things so complicated?
by timr on Saturday December 31, 2011 @06:10PM
(#3412159)
"Not using shared_ptr a code smell?"
Yes. It's part of the C++ standard. All rants against Dave Abrahams and Boost aside, not using the standard library to do standard things is a code smell.
Re:Why do C++ folks make things so complicated?
by zvrba on Monday January 02, 2012 @04:00PM
(#3417317)
What "standard things"? shared_ptr is only one of many possible ways to keep track of object lifetimes. Rolling your own reference-counted smart pointer might be a code smell, but not choosing reference counting is far from that.
Not using shared_ptr a code smell? If you're not able to keep track of your objects yourself, you should not be using C or C++. It's not that hard like you would like us believe.
Also, apart from the cost of maintaining reference counts, shared_ptr makes an extra allocation for the control block. Unless you take care and use make_shared, you end up with allocations that are twice as slow.
On a cynical side: Boost has become Dave Abrahams' business (1) He (and co.) have a vested interest in making you believe that the Boost-way is "the" way of writing "modern" (as defined by HIM and his followers) C++ code. I just wonder whether he had that much foresight, or just took the chance when he saw the opportunity.
(1) I remember once asking about obtaining slides about fusion from a past BoostCon conference and got a blank "no". Slides were available only to the people who paid to attend the conference.