I wrote endless loops like these many times over the years in C and C ++, but today I first thought about it - why is it an endless loop when the condition condition is empty? One would expect that you need to write something like this for(;true;);
to get a valid infinite loop?
while();
does not compile and does not execute while(;);
In any case, I like the syntax for(;;);
and use it often, but is it a special case to consider an empty conditional block as true, or are there other cases in C or C ++ where the expression for an empty condition is interpreted as true?
source
share