while(true) versus for(;;)

c++, infinite-loop

Solution

With optimizations enabled, they will compile identically.

You should use whichever one you find more readable.

Problem

Possible Duplicates: Is “for(;;)” faster than “while (TRUE)”? If not, why do people use it? for ( ; ; ) or while ( true ) - Which is the Correct C# Infinite Loop? Is there any appreciable difference between `while(true)` (or `while(1)`) and `for(;;)`? Would there be any reason to choose one over the other?

Original source

Related problems