It only matters if the result of the ++ operator is being used elsewhere on the line.
For example:
1 2 3 4 5 6 7 8 9
|
int a = 1;
int b = ++a;
// a=2
// b=2
a = 1;
b = a++;
// a=2
// b=1
|
If you are not passing b++ to a function, assigning it to a variable, or doing anything else with it other than incrementing b, then it doesn't really matter* as both pre and post operators have the same impact on b.
* Where it does matter is when 'b' is a object that has the ++ operators overloaded. In that event, which ++ you use can call two entirely different functions, and the performance difference of those functions can vary. Typically, the post (b++) requires an object copy(-ies) and is therefore less efficient. But that's not always the case.
If the ++/-- operators are inlined, then it generally doesn't matter because (I'd imagine) most compilers will optimize out the unnecessary copies. So for stuff like STL iterators, it probably doesn't matter, since that stuff is probably all inlined.
If they're not inlined though, it can make a difference, because there's no way for the compiler to optimize out the copy(-ies) since its done in the function, so there's no way it can know that its unnecessary.
In any event... I recommend getting in the habit of using the prefix form (++a), since it'll never* yield worse performance and might yield better performance sometimes. Unless of course you need the postfix form because you're combining it with an assignment or something -- but ew @ compound operations.
* (it would be possible to write a prefix form that is less efficient than the postfix form, so I can't say 'never' here and really mean it -- but in all properly written prefix/postfix operator overloads, the prefix form would be preferred)
EDIT:
also, helios and firedraco are right, of course. in the above mentioned loops, there is no difference between using ++a or a++. Both loops will have a start and stop with the same values.