From discussions on stack overflow we have:
++i
does not expect to return a value whilei++
might need to return a value.- A modern compiler, for simple data types (i.e. integer) will treat the two
the same if the context is right e.g. in a
for
loop - For an object (e.g. an interator), however,
++i
will be faster thani++
because a compiler cannot optimize away the creation of a temporary object fori++
Comments
Post a Comment