David García Garzón
dgarcia at iua.upf.edu
Wed May 27 01:09:45 PDT 2009
A Dimarts, 26 de maig de 2009 10:51:36, Dirk Griffioen va escriure:
> Hi David,
> > 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.
Yes, and i was waiting for you to say that ;-) I guess that introducing boost
into CLAM is not a priority for your employer but if besides that you end up
doing it here are the tips:
For Windows, feeding this monster:
Optionally feeding this other one:
And updating this binary:
Also updating nsis scripts to install the required dll's.
Mac, feeding this monster:
And updating the bundle generation to include the required dll's.
For linux, updating the INSTALL file with the new dependency.
In general some scons work must be done in:
I am sure that as soon as you see the Sconstruct code you will want to
refactor it. I do. Feel free to proceed keeping an eye on the testfarm page.
> 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
> boost packages:
> the 'old' smartpointer package (in development since 1999)
> and a new one
> where you can do things like:
> boost::ptr_vector<animal> vec;
> 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 ...
I do like it for most uses of pointer's vectors. I guess that a little care
should be taken on resizes and deletion code as they are now done.
David García Garzón
(Work) dgarcia at iua dot upf anotherdot edu
More information about the clam-devel