Re: Why use loop would simple if/minus would do?

From: Pete Cockerell (pcockerell_at_yahoo.com)
Date: 03/03/04

  • Next message: rohitarora_at_myrealbox.com: "no popup"
    Date: 2 Mar 2004 17:26:18 -0800
    
    

    This does seem like an astonishingly bad piece of code. I hope you get
    your RFE/Bug accepted. Which JDK version is this in (i.e. have they
    fixed it in 1.5?)

    Cheers,
    Pete

    st946tbf@drexel.edu (VD) wrote in message news:<f4aa172.0402272103.5be7db02@posting.google.com>...
    > I look at Sun's GridbagLayout code and the following lines really makes me
    > feel strange some how:
    >
    >
    > /* Adjust the grid width and height */
    > for (px = curX + curWidth; layoutWidth < px; layoutWidth++);
    > for (py = curY + curHeight; layoutHeight < py; layoutHeight++);
    >
    > Can't the statement be changed to something like this (or something similar)
    >
    > px = curX + curWidth;
    > if(layoutWidth < px){
    > layoutWidth = px;
    > }
    >
    > py = curY + curHeight;
    > if(layoutHeight < py){
    > layoutHeight = py;
    > }
    >
    > This is really a great inefficiency if I am not wrong, unless the compiler
    > does the optimization automatically, which I doubt it does.
    >
    > What do you think? RFE?


  • Next message: rohitarora_at_myrealbox.com: "no popup"