[geos-devel] Issues with smart pointers and threads?

Ferdinando Villa fvilla at zoo.uvm.edu
Wed May 28 08:54:48 EDT 2003


On Wed, 2003-05-28 at 03:51, Norman Vine wrote:
> The beauty of the auto_ptr auto_ref approach is that once
> you accept the fact that it works much of the memory allocation 
> deallocation bookwork is taken care of for you auto magically
> by the compiler and is guaranteed to be done correctly in an
> 'exception safe way', and in general the resulting code is *much* 
> cleaner.
> 

Just like Java! :) Smart pointers are probably the only thing that NEVER
gave me a headache in years and years of C++ coding. On the other hand,
back to the shared PrecisionModel thing, a precision model is three
doubles and an int... and the copy constructor does a fabs and a couple
assignments. Once the constructor and setScale are inlined (please)
constructing one shouldn't really be slower than assigning a pointer and
incrementing a counter - and would probably be faster than doing that
with locking. So I guess it's your call - particularly if this is the
only place in GEOS where this is needed.

ciao f

> I do realize that it takes a bit of a leap of faith to accept this :-)
> 
> A judicous typeedef or two can help hide the complexity also
> http://www.gderek.lolo.com.pl/c++-faq/exceptions.html
> 
> Cheers
> 
> Norman
> 
> _______________________________________________
> geos-devel mailing list
> geos-devel at geos.refractions.net
> http://geos.refractions.net/mailman/listinfo/geos-devel
-- 
ferdinando villa, ph.d.                    associate professor
gund institute for ecological economics, university of vermont
590 main street, burlington, vt 05405    phone: (802) 656-2972




More information about the geos-devel mailing list