On Thu, Dec 2, 2010 at 6:17 PM, Richard <legalize at xmission.com> wrote:
In article <1291324333.29855.11.camel at ryoko>,
? ?Philip Pemberton <classiccmp at philpem.me.uk> writes:
[...] If the condition is omitted, it is
assumed to be TRUE.
This is the part I'm trying to find in the standard. ?I'd never seen
someone write an infinite loop by *omitting* the condition on a for
loop.
I think you are imagining it backwards. A for loop continues *until*
the condition is true. (i > 10 or some such). A _missing_ conditional
test is always false, so the loop test will never satisfy, so the loop
will never exit on its own (which is why a break or a processor reset
is needed to break out of it).
?I've seen it written as while (1); or while (1)
{}.
Those are correct as written, but they are a different keyword with a
different sense on the test. A while loop continues _as long as_ the
test is true. 1 is never 0, so it's always true.
-ethan