Boost logo

Boost :

From: Igor.Smirnov_at_[hidden]
Date: 2007-09-19 08:21:55


Hello,

I am trying to respond on the discussion (in the developer's list) on the
indicated topic which were in 3-7 Sept. 2007. Not sure my e-mail will go
by the right way (because of some technical troubles). But trying...

Mathias Gaunard wrote:

> Edd Dawson wrote:

> > I'm confused. Surely the whole point of shared_ptr is to relieve the
> >programmer
> > of the burden of worrying when its still used.

> The problem is that with large programs you're not able to tell easily
> where it is being used. (also, you may create cycles by oversight, but
> that could be fixed eventually)
> The fact that it is automatically destructed when not used doesn't not
> mean that it can't be still used at wrong places, especially after code
> refactoring and modifications.
>

> > How are programs made more deterministic?

> Because ownership is fixed to a scope. You thus perfectly know when the
> object will be constructed and destructed.
> With shared ownership, ownership is fully dynamic, and thus not
> determined.

These statements (from Mathias Gaunard) are very similar to those which I
was trying to popularize in this news group a few years ago and first time
even some 5-7 years ago. Though it seemed that I could not convince the
majority (in particular that the shared pointers are in general
unnecessary). But I am myself still convinced, although admit that shared
pointer is acceptable in some rare exclusive circumstances.

But, the content of Foo class, which Mathias Gaunard proposed in its
first mail, is not clear for me.

May be I am behind progress, but I do not know a way to make cloning
pointer (or that Mathias' value object, but this seems to be the same in
principle) to be non-intrusive. You anyway need virtual cloning function
in each class of the hierarchy.

I am trying to maintain an Internet page about these things, see

http://cern.ch/ismirnov/safetl

Regards

  Igor Smirnov


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