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



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





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