Re: [gtkmm] Talk about a major rewrite



>One more thing is that of iterators. By referring to an object with its 
>pointer, bad coding results in havoc. One example is when I deleted an object 
>and the iterator was still around. It is very diffficult to check the 
>consistency of data holded by pointers. On the other hand, integer indexes of 
>C lists are easier to debug. Giving a bad index can be recognized at once. 
   ^^^^^
     you presumably mean "arrays". "list" is generally used to refer
     to an object that uses indirection to get from one element to
     the next (whether it uses contiguous memory or not as the storage
     model).

It cannot. If the indexed array holds pointers, there is no way to
know that the index will access a valid element, let alone the
intended one. If the indexed array holds objects, then its incredibly
expensive to sort it or carry out other interesting operations such as
mid-point insertion. 

Much of my code uses containers that hold items which are semantically
impossible to copy, and even if you could, it would be too expensive
to do so. You can't feasibly build containers that hold the items
themselves - only pointers to them. Instantly, you're right back at
the same old dangling pointer issue, which C++ provides some excellent
tools for handling. Oh, wait:

>I'm also working on a model to replace reference counting. As I mentioned 

I am sure that the entire programming world will be interested in your
results. Reference counting is an old and rather well-established
method of managing object lifetimes. There are others, but for some
reason, none seem to have the broad acceptance that refcnt-ing does. I
wonder why.

--p



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