Re: while (1) vs. for ( ;; )
- From: Tim Rentsch <txr@xxxxxxxxxxxxxxxxxxx>
- Date: 30 Aug 2005 13:04:36 -0700
pete <pfiland@xxxxxxxxxxxxxx> writes:
> Tim Rentsch wrote:
>
> > I was surprised at how many people reported that a compiler
> > they use issues a warning for 'while(1)' and gave that as a
> > reason for giving preference to the 'for(;;)' form. It
> > seems like a choice should be made on the basis of what's a
> > better expression (lower defect rate, higher productivity,
> > better understood by the readers), not on the basis of some
> > errant warning message.
>
> The warning is the tie breaker.
>
> There is no difference in defect rate,
Is this statement just one of belief, or are you offering
some evidence?
> productivity,
There is for some developers. Among other things, some
debugging techniques work better when the 'while(1)' form is
used. If the people who prefer the 'for(;;)' form don't see
any difference in productivity, that seems to be an argument
in favor of using the 'while(1)' form.
> or understanding by the readers.
At least one poster in this thread said something along
the lines of using 'while' for "looping" and 'for' for
"iteration". In the non-infinite case, that's usually
my leaning also. So there is *some* difference in how
the two forms are understood.
Overall, I still believe that the direct effects on the
developers have a more significant effect than do the
effects of a warning message issued by a compiler,
especially since it's easy to get around that message being
issued. But that's just a statement of belief; if we
want to be sure, we should set up a comparison and
gather some sort of objective evidence.
.
- Follow-Ups:
- Re: while (1) vs. for ( ;; )
- From: Keith Thompson
- Re: while (1) vs. for ( ;; )
- References:
- while (1) vs. for ( ;; )
- From: Michael B Allen
- Re: while (1) vs. for ( ;; )
- From: Tim Rentsch
- Re: while (1) vs. for ( ;; )
- From: pete
- while (1) vs. for ( ;; )
- Prev by Date: Re: while (1) vs. for ( ;; )
- Next by Date: Re: object code from which compiler
- Previous by thread: Re: while (1) vs. for ( ;; )
- Next by thread: Re: while (1) vs. for ( ;; )
- Index(es):
Relevant Pages
|