Loop Optimization

Debajyoti Chatterjee dchatterjee172@gmail.com
Thu Oct 13 06:11:00 GMT 2016


Hello,
I was wondering if gcc can optimize this type of for loop using loop
rollback technique,
for(int i=5;i--;){//body}
in general we use,
for(int i=0;i<5;i++){//body} , this type of loops are easy to
understand for compilers and as 5 is constant compiler can apply loop
rollback technique to optimize.
I wonder which type of for loop will be good to use.
i will be grateful if someone responds.
Thanking you,
Debajyoti Chatterjee



More information about the Gcc-help mailing list