also the ++ operator is the same as loop = loop + 1. well depending on if you use it ++loop or loop++ there will be some differences but you can google that
also the ++ operator is the same as loop = loop + 1. well depending on if you use it ++loop or loop++ there will be some differences but you can google that
AFAIK, in this situation it makes absolutely no difference, not even to performance. However if iterators were being used then ++iterator would be more efficient than iterator++
AFAIK, in this situation it makes absolutely no difference, not even to performance.
Right, that makes no difference in the for-loop, the only difference I've learnt is that ++loop increase the variable before using it, while loop++ increase the variable after using it.
However if iterators were being used then ++iterator would be more efficient than iterator++
Could be elaborate more on this, is ++iterator significantlymore efficient than iterator++?
in this situation yes it doesnt make a difference.
@yueeng: i dont believe so. because it turns into the command inc [Loop] either way, the compiler just determines where it is put
Unless your compiler is too stupid to use even the most basic optimizations, it won't make a difference for primitive types. But the main issue is the habit you form - it does make a difference with iterators with some compilers and some optimization levels, so you should get into the habit of using pre-increment and pre-decrement when possible. Otherwise you will be inconsistent.
Yes. Just remember that something++ actually creates a copy of the object, increments the original and then returns the copy. That's two copies per call.