Re: [Vala] [vala] for loop



Hi,

On Fri, 2010-06-25 at 10:27 +0000, gerhard gruber documatrix com wrote:
Why do you write a for loop in this way? I think there are some
reasons, but I did not find them.
But when it is necessary to write a while loop instead a for loop
would it not be better, if the generated code looks like this?

The compiler converts internally all loop variations into a generic
infinite loops with appropriate if and break statements. This helps
keeping flow analysis and code generation simpler (especially regarding
error handling).

In this way you do not need the _tmp0_ variable, which could improve
the performance of the for loop, couldn't it?

This should not make any difference when building with optimizing C
compilers. If you have a test case where you notice a measurable
performance difference, we can check whether there might be worthwhile
optimization possibilities.

Jürg




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]