Boost logo

Boost :

Subject: Re: [boost] deleting smart pointer
From: Stewart, Robert (Robert.Stewart_at_[hidden])
Date: 2011-03-21 07:00:20


pavel wrote:
> Steven wrote on Friday, March 18, 2011 at 21:02:13:
>
> > Second, how is it horrible? Of course it is (almost) like
> > p.reset(). Assigning anything to a shared_ptr
> > decrements the reference count on the old value.
>
> rephrasing your words: how is 'delete p' a bad idea? it's obvious it
> is almost like 'p.reset()'

As has been repeated often, because the two mean quite different things and no one else, it would seem, is at all comfortable with your conflating the two.

> deleting a smart pointer decrements the reference counter and releases
> the memory if the count drops to zero

We understand, quite well, what you are proposing.

> > Because the behaviour of delete is
> > well-known. You want add a new
> > meaning which is similar enough to
> > cause confusion. I object to using
> > clever tricks like this just because
> > we can. In my opinion, the only
> > legitimate reason to "overload"
> > delete like this would be to allow
> > a template to treat raw pointers
> > and shared_ptrs polymorphically.
> > Such code is probably wrong anyway.
>
> that's what we try to figure out here

No, that's what you proposed and are now trying to force on others.

> i'll rephrase it: deleting a pointer states that the scope of the
> pointer instance does not need the data pointed to (by the pointer
> instance)
>
> here a pointer may be a plain pointer or a smart one; the scope of the
> pointer may be a function or whole program

Understood...from the start.

> no offence but is my english really so bad that almost noone can
> understand what i am talking about?

Nope. Your English has been just fine. We understand, and have done so from the start, what you've proposed and continue to dislike the idea for technical, semantic, and aesthetic reasons.

_____
Rob Stewart robert.stewart_at_[hidden]
Software Engineer using std::disclaimer;
Dev Tools & Components
Susquehanna International Group, LLP http://www.sig.com

IMPORTANT: The information contained in this email and/or its attachments is confidential. If you are not the intended recipient, please notify the sender immediately by reply and immediately delete this message and all its attachments. Any review, use, reproduction, disclosure or dissemination of this message or any attachment by an unintended recipient is strictly prohibited. Neither this message nor any attachment is intended as or should be construed as an offer, solicitation or recommendation to buy or sell any security or other financial instrument. Neither the sender, his or her employer nor any of their respective affiliates makes any warranties as to the completeness or accuracy of any of the information contained herein or that this message or any of its attachments is free of viruses.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk