Re: [gtkmm] "manage" and Glib::RefPtr



Hello,

I'd like to tell you, why I choose gtkmm. I hope I can prevent you from 
destroying a main goal of this well designed library.

The best thing on gtkmm is, that it really uses standard C++. C++ knows stack 
objects as well as heap objects. Heap objects are very important in dynamic 
environments. A GUI can be a dynamic environment, too. Imagine a UI that is 
constructed from a XML file. You do not know, which and how much objects you 
need.
Gtkmm can deal with all these types of standard C++ memory management methods. 
These are clear. And everyone who knows C++ can understand gtkmm. The only 
thing a C++ programmer does not understand easily is that he has to use 
mangage for dynamic objects. He would understand if he was to delete the 
dynamic objects in the destructor of the window or at any other place. He 
would also understand, if he were to give a reference to an owning object to 
the constructor of some widget like in delphi.
I think every "enhachement" made to the memory management system of C++ is a 
big backstep.
You need no refcounting. Refcounting is a feature for programmers who spread 
pointers all over the program. There's no refcounting in standard C++ because 
the people who defined the standard are good software developers. I say: 
Before introducing such a horrible feature, organize your software! The 
programmer must have real control over the lib, not the lib over the 
programmer. The lib shall serve the programmer and not make him headaches, 
why some objects are not destroyed when he wants them to.

PS: new/delete is standard C++ because it is flexible, transparent and easy to 
use.

Another Daniel ;-)

Am Thursday 10 October 2002 15:01 schrieb Daniel Elstner:
> Am Don, 2002-10-10 um 16.11 schrieb Paul Davis:
> > >> 	Ouch! Personally, I wouldn't like this at all. Remove standard C++
> > >> memory management from the mix. Very unpalatable IMHO. ;-)
> > >
> > >I've no idea why new/delete is widely regarded as standard C++ memory
> > >management.  The standard way of memory allocation in C++ is on stack.
> >
> > stack-based allocation cannot work without reference counting,
> > and there is no standard system for this in C++. hence Glib::RefPtr,
> > boost::this_and_that, auto_ptr<T> etc. etc.
>
> Huh?  If I instantiate an int, a double, a std::vector<> etc. on stack
> no reference counting is performed.  std::auto_ptr<> doesn't do
> reference counting either.
>
> It is true that there's no standard system for reference counting in
> C++, but I wasn't arguing that.  Regardless whatever reference counting
> smart pointer you're using, the referencing/unreferencing is
> scope-based.
>
> --Daniel
>
>
> _______________________________________________
> gtkmm-list mailing list
> gtkmm-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtkmm-list




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]