loop optimization
Mark Lundeberg
aa026@pgfn.bc.ca
Tue Aug 1 14:47:00 GMT 2000
In my programs, if I want to iterate <count> times, I will use
while(count--) (or while(count-- > 0) )
{
commands;
}
This nicely prevents the need for another variable, and only requires a
compare against a constant rather than against another variable.
Of course, if I want an iteration of <count-1>, then I use
while(--count) (or while(--count > 0) )
My question is, will gcc see this as a target for optomization as it would
for "for(i=0;i<count;i++)"?
Mark Lundeberg <aa026@pgfn.bc.ca>
http://www.pgfn.bc.ca/~aa026/
More information about the Gcc-help
mailing list