Preincrement faster than postincrement in C++ - true? If yes, why is it? [duplicate]

Possible Duplicate:
Is there a performance difference between i++ and ++i in C++?

I heard about that preincrements (++i) are a bit faster than postincrements (i++) in C++. Is that true? And what is the reason for this?


Post-increment usually involves keeping a copy of the previous value around and adds a little extra code. Pre-increment simply does it's job and gets out of the way. I typically pre-increment unless the semantics would change and post-increment is actually necessary.


On any decent compiler, ++i and i++ are identical if the value is not used.

If the value is used, ++i would need a temporary to store the pre-increment value if identical semantics were wanted.