QA


Q&A

Q.

Is there ever a situation where you would want a loop to run indefinitely?

A.

Game programmers often create a single loop that runs indefinitely, and all logic and user input takes place in this main loop. Other than such a very specific situation, all loops should terminate at some point.

Q.

Should I be concerned about the performance differences between the two types of loops?

A.

With today's fast processors, chances are good that the performance difference between the two loop types in any given situation will be overshadowed by the readability and functionality of the best choice of loop. If you have a situation in which performance is critical, write the loop using all the ways you can think of, benchmark the results, and choose the fastest loop.




Sams Teach Yourself Microsoft Visual C# 2005 in 24 Hours, Complete Starter Kit
Sams Teach Yourself Visual C# 2005 in 24 Hours, Complete Starter Kit
ISBN: 0672327406
EAN: 2147483647
Year: N/A
Pages: 248
Authors: James Foxall

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net