On Thursday 15 July 2004 00:54, MenTaLguY wrote:
On Wed, 14 Jul 2004, MenTaLguY wrote:
On Wed, 14 Jul 2004, Aubanel MONNIER wrote:
Does the inkscape code already uses smart pointers somewhere ?
No.
glibmm does provide a smart pointer class which will have to be used with some gtkmm classes.
Since we will not be switching the entire codebase to garbage collection at once, we could conceivably use that, or write our own (smart pointer classes are simple, and I don't like the method names imposed by glibmm's).
On the other hand, I don't like smart pointers so much because they tend to impose additional reference counting overhead and then hide it; it's very easy for your performance to die a death of a thousand cuts if you use them pervasively[1].
-mental
[1] Some algorithms are implemented most efficiently using pointer assignment. Unless your smart pointer class provides means to "unwrap" the bare pointer underneath (glibmm's does not), you pay must pay the following costs for each assignment:
a. simple overhead for dereferencing the pointer and updating the reference count b. cache effects from updating the reference count (probably negligible in most cases, since you're likely working with the object in question anyway) c. if you care about threads, locking overhead to protect the reference count
For the momment, I used shared_ptr from boost.
http://www.boost.org/libs/smart_ptr/shared_ptr.htm
but maybe we should provide our own implementation ?
Not saying that we must put smart pointers everywhere, but in some circumstancies they are very usefull (eg when dealing with containers)
This SF.Net email is sponsored by BEA Weblogic Workshop FREE Java Enterprise J2EE developer tools! Get your free copy of BEA WebLogic Workshop 8.1 today. http://ads.osdn.com/?ad_id=4721&alloc_id=10040&op=click _______________________________________________ Inkscape-devel mailing list Inkscape-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/inkscape-devel