[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [cp-patches] FYI: BoxLayout fixlet
From: |
Mark Wielaard |
Subject: |
Re: [cp-patches] FYI: BoxLayout fixlet |
Date: |
Tue, 04 Oct 2005 17:28:12 +0200 |
Hi Roman,
On Tue, 2005-10-04 at 16:52 +0200, Roman Kennke wrote:
> // Sum up (maxSize - prefSize) over all children
> int sumDelta = 0;
> for (int i = 0; i < children.length; i++)
> - sumDelta += children[i].maximum - children[i].preferred;
> + {
> + sumDelta += children[i].maximum - children[i].preferred;
> + if (sumDelta < 0)
> + sumDelta = Integer.MAX_VALUE;
> + }
A comment here might be nice to explicitly tell the reader this is
because of overflow. Also you can probably just break from the loop at
this point since from then on you will always overflow with each next
child.
Cheers,
Mark
signature.asc
Description: This is a digitally signed message part