Possible Duplicate:
Is there a performance difference between i++ and ++i in C++?
Google's C++ Style Guide[1] states that using preincrement(++i
) is often more efficient than using postincrement(i++
) so it's preferable as the meaning is the same if the return value is ignored.
If you're talking about a native type the difference is probably negligible in almost every case, but if you have an overloaded class I understand it can make a difference. Anyway, considering the case that the return value doesn't matter, isn't this the perfect target for a compiler optimization? Does it happen in modern C++ compilers? If not, why?