Saturday, April 14, 2007

Pre-increment and post-increment : achieve "almost" the same end result with a little difference. It is always adviced to use the pre-increment form in expressions where you do not care what value the expression ought to use - the new incremented one or the older value prior to increment. Also when it matters, if you need the former then use the pre-increment form and if the latter use the post-increment form. That is the basic difference.

The post increment form has a drawback of generating a temporary (yeah, that can be optimized by the optimizer but still).