On Thursday 28 July 2011 01:00:10 Hal V. Engel wrote:

> But there is one minor and very common issue with the code that should be
> fixed.  In the for loop
> 
> for (..; ..;  j++)
> 
> should be
> 
> for (..; ..; ++j)
> 
> if you use j++ the compiler has to make a copy of j with each iteration of
> the loop but if you use ++j it does not have to make a copy.  This will
> make the loop more efficient although only by a small amount.

Are you sure about that? I just tried it with a little example and at least 
gcc compiles both variants to the exact same assembly code. Tried it with and 
without -O2.

Regards,
Stefan

------------------------------------------------------------------------------
Got Input?   Slashdot Needs You.
Take our quick survey online.  Come on, we don't ask for help often.
Plus, you'll get a chance to win $100 to spend on ThinkGeek.
http://p.sf.net/sfu/slashdot-survey
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to