On Sat, 5 Feb 2011, Alan Coopersmith wrote:

I think it used to be faster to count down and compare against zero on some
CPU's (probably 680x0 or so), and you do see that a bit in the ancient X code.

I can't see any other reason to do the counting this way here, so will look into
turning it around.

It's more likely that the developer had observed poor optimization resulting in repeated reevaluation of the expression which would be in the loop termination clause.

On 02/ 5/11 02:47 AM, walter harms wrote:


            for (i = num_typed_args - typed[j]; i > 0; i--, arg++) {

IMHO this violates the rule of least surprise. the other way around is much more
common. Since i is only a counter i do not see why we need to count down.
(More adventures people may want to use memmove, but i did not see the rest of 
code)

                    for (i=0; i < num_typed_args - typed[j]; i++) {
                        *arg = *(arg+1);
                        arg++;
                    }

just my 2 cents,

--
Thomas E. Dickey
http://invisible-island.net
ftp://invisible-island.net
_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to