[H-GEN] Which is better?

David Starkoff dbs at uq.net.au
Tue Apr 27 08:20:32 EDT 2004


At 2004-04-26T15:53+1000, Anthony Towns wrote:

> Of course, if you're into micro-optimisation, then you really should be
> writing:
> 
>     for (int i = myArray.length; i != 0; i--)
>     {
>       ...
>     }

Shouldn't it be "--i" rather than "i--" so the previous value doesn't
need to be (superfluously) kept around?

  3.7: If I'm not using the value of the expression, should I use i++
  or ++i to increment a variable?

  ++i. Only losers and idiots use i++. [...]

David.
(I heart <http://www.plethora.net/~seebs/faqs/c-iaq.html>.)




More information about the General mailing list