dirk.griffioen at barcelonamedia.org
Tue May 26 01:51:36 PDT 2009
> On Monday 25 May 2009 19:06:38 David García Garzón wrote:
> > On Monday 25 May 2009 18:29:40 Dirk Griffioen wrote:
> > > - please note: with the use of smartpointers, this whole line becomes
> > > obsolete as they and their resources are destructed when the vector is
> > I know the implications on what we are doing now, we have a clear memory
> > management policy, following it is not difficult and spoting the bugs of
> > this kind of construction is very straight forward for us. I cannot say the
> > same of the use of smart pointers as most of the things happen behind the
> > scene.
> That said, i am not trying to ban the use of smart pointers. Just that it is
> something that must be discussed with calm. I guess that smart pointers would
> imply some other kind of policy we should stablish and learn. How to deal
> with circular references, where to detach pointers, when and how giving away
> references... I see no gain on porting the whole code base to smart pointers.
> It is a lot of work that can be used to more useful things for the project.
> If you write new code that could be a place to introduce them but also a
> requirement for that would be solving crossplatform distribution of the
> dependencies (boost).
I would be very interested in learning about and helping to solve the
crossplatform issues, as I believe having (parts of) boost would be very
beneficial to clam.
Having said that, smartpointers are based on RAII ('resource aquisition
is initialization' -
This is not a policy but a strong guarantee by the language that
acquired resources will be freed: I simply cannot make a fault, by
definition (which is a nice position to be in :)
Because it is so usefull, Java/C# added the 'using' keyword even in the
presence of their garbage collector.
Regarding references/detach etc - these issues have been solved in the
the 'old' smartpointer package (in development since 1999)
and a new one
where you can do things like:
vec.push_back( new animal ); // you add it as pointer ...
vec.eat(); // but get a reference back
(which looks surprisingly how clam handles memory, but with more safety
attached; see the motivation:
So if we can add boost as a depency, we might want to consider it for
new code ...
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the clam-devel