Re: while (1) vs. for ( ;; )



Richard Heathfield <invalid@xxxxxxxxxxxxxxx> writes:

> Tim Rentsch said:
>
>[snip]
>
> > My first reaction was that he's meaning to say that loops
> > that look infinite (but aren't) are bad,
>
> All else being equal, yes...
>
>
> > and the code should
> > be reworked so that the loop control expression is really
> > what controls the loop body.
>
> ...and yes.
>
> (This reply is purely for clarification of my earlier intent - I did read
> the rest of your article, and I accept that our viewpoints differ.)

Are they really different? What I said was that some loops
are better with the exit condition in the loop body rather
than the control expression; such loops don't occur
commonly. Do you really mean to say that _no_ loop, at any
time under any conditions, should be written with a constant
control expression? Not counting of course examples like
the microwave oven driver loop, which you explained already.
.



Relevant Pages

  • Re: while (1) vs. for ( ;; )
    ... > What Richard might be saying, but isn't really what I think ... is that the control expression should ... > loop is never exited by the test on the loop control. ... Richard Heathfield ...
    (comp.lang.c)
  • Re: while (1) vs. for ( ;; )
    ... is that the control expression should ... >loop is never exited by the test on the loop control. ... I hope that's not what he's saying. ... Balmer Consulting ...
    (comp.lang.c)
  • Re: while (1) vs. for ( ;; )
    ... I would rather have the loop control ... > statement explicitly document the exit condition (unless there genuinely ... is that the control expression should ... loop is never exited by the test on the loop control. ...
    (comp.lang.c)
  • Re: Very Basic Performance Question
    ... "Rhino" scribbled on the stall wall: ... Your intuition is correct. ... the loop statement, storing its value in a temporary variable, unless there ... the control expression from within the loop. ...
    (comp.lang.java.programmer)
  • Re: LOOP blows!
    ... and initialization of all variables takes place in the prologue. ... the initial `binding' of loop vars for all other FOR-AS ... So FOR-AS-EQUALS differs from other for clauses in another way: ... | tests and the loop body. ...
    (comp.lang.lisp)