Possible Duplicate:
Is there a performance difference between i++ and ++i in C++?
I saw many places where they use for loops like this:
for(i = 0; i < size; ++i){ do_stuff(); }
instead of (which I -& most of people- use)
for(i = 0; i < size; i++){ do_stuff(); }
++i
should exactly give the same result as i++
(unless operators overloaded differential). I saw it for normal for-loops and STL iterated for loops.
Why do they use ++i
instead of i++
? does any coding rules recommends this?
EDIT: closed cause I found that it is exact duplicate of Is there a performance difference between i++ and ++i in C++?