Yeah the value copy is necessary to return the old (pre-increment) value with i++. However, your compiler is (usually) smart enough to optimize the copy away if you never use it.
That being said, being explicit is good, so use ++i if you don’t need the old value. Don’t depend on the compiler to maybe do something.
Yeah the value copy is necessary to return the old (pre-increment) value with i++. However, your compiler is (usually) smart enough to optimize the copy away if you never use it.
That being said, being explicit is good, so use ++i if you don’t need the old value. Don’t depend on the compiler to maybe do something.