[haiku-commits] Re: r40762 - haiku/trunk/src/apps/terminal

  • From: Ingo Weinhold <ingo_weinhold@xxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Wed, 02 Mar 2011 14:56:21 +0100

On 2011-03-02 at 14:05:47 [+0100], Axel Dörfler <axeld@xxxxxxxxxxxxxxxx> 
wrote:
> Ingo Weinhold <ingo_weinhold@xxxxxx> wrote:
> > Am I the only one thinking that the BObjectList::RemoveItem()
> > deleteIfOwning
> > parameter should not have a default? I find the current situation
> > rather
> > inconsistent with RemoveItemAt() which doesn't have such a parameter
> > and
> > doesn't delete the object either.
> 
> The API certainly won't win any prices :-)
> There is a semantical difference between the two methods, though:
> RemoveItemAt() returns the item in question (that you don't know
> before), ie. it passes it over to your responsibility, while
> RemoveItem() does not, the ownership is kept with the list (if that
> actually claims ownership).

One could decide to use RemoveItemAt() just because the method is faster 
when one already knows the index of the object. I don't think I would 
prefer adding a deleteIfOwning parameter. I believe the cleanest solution 
is to just remove the deleteIfOwning parameter from RemoveItem() as well 
and never delete the item in question (requires all using code to be 
adjusted). After all the only thing this ugliness saves the caller is an 
explicit delete.

At any rate, the MakeEmpty() deleteIfOwning parameter makes a lot more 
sense and I would remove its default value.

CU, Ingo

Other related posts: