Jonathan Wakely wrote:
> On 29/11/2007, Warren Young <mysqlpp@stripped> wrote:
>> And in
>> the assign(T*) case, I'm pretty sure assigning the same pointer will
>> result in a double-delete. I've added explicit checks to both assign()
> Forgot to answer this bit ... that can only happen as a result of a
> stupid programming error, you'd have to say: p1.assign( p2.get() )
> so it's pretty obvious you've just made p1 and p2 own the same
> resource, but without sharing a refcount.
Oh, crumb...This is the very error I foresaw when I decided the guard
was necessary for the T* case, but in processing your previous message,
I convinced myself it couldn't happen.
Actually, I conceived of it happening a little more verbosely:
Foo* bar = something_that_makes_foos();
... many fascinating and interesting things happen here ...
... still other stuff happens ...
qux = bar; // who knows why, but say you do this...
Still unlikely, I admit...
I guess I'm satisfied leaving it unprotected until a need for protection
> I probably should have added comments to explain some of the code ...
It's always a third party that tells you how extensive the documentation
needs to be. I'd only expect excellent documentation from you on these
patches about six months from now when you are new to it again.
I discover lapses and even outright errors in the userman, for example,
almost every time I reread a section of it. That's one reason I do it.