[haiku-commits] Re: haiku: hrev45452 - src/apps/deskbar

  • From: pulkomandy@xxxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sun, 07 Apr 2013 10:07:45 +0200

> I seem to recall this was brought up before and the conclusion was that
> CountItems() could be optimized by the compiler. I'll try to find the
> discussion and see if I'm remembering wrong. If this is bad I'll return to
> using a count variable. Thank you for checking me here.

Well, the compiler can't optimize this if you are changing the count inside 
the loop, there's a change of semantics (and behavios) if it does. If the 
method actually returns a cached count, then it's ok to leave it as is. The 
method should be renamed (to GetItemCount or something similar) but maybe 
it's part of the BeAPI and we can't do that. I'd go with a comment above the 
for loop, just so I stop to bug you against these :)

-- 
Adrien.

Other related posts: