MfA said:Assuming whether you use i++ or ++i matters for the correctness, and you change your program flow to use one or the other I wouldn't be so sure pre-increment is faster. With pre-increment you avoid creating a copy, and you create a short range dependency ... bit of a mixed bag. Sure for a complex iterator the copy weighs heavily, but for an int?
Assuming it doesn't matter which you use I doubt a compiler creates different code either way.
Pre increment will be faster for iterators, but not for basic types.