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

Norman Vine nhv at cape.com
Wed May 28 03:51:38 EDT 2003


Martin Davis writes:
> 
> I agree, Dave - I think that reference counting is going to be a 
> lot harder to implement, debug, and verify than simply using 
> value objects.  I'd prefer to avoid as much complexity as 
> possible in GEOS - dealing with the algorithm side of things is 
> complex enough.  

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.

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



More information about the geos-devel mailing list