Re: while (1) vs. for ( ;; )
"Charlie Gordon" <news@chqrlie.o rg> wrote in message
news:df3mnb$l4f $1@reader1.imag inet.fr...[color=blue]
> "Baxter" <lbax02.spamgua rd@baxcode.com> wrote in message
> news:11ha0ubdt7 e1g18@corp.supe rnews.com...[color=green]
> >
> > Why not code it like you would read it in English:
> >
> > bool done = false;
> > while (!done) { // while not done do[/color]
>
> do not paraphrase code in comments.[/color]
I don't - I was illustrating how one would read this in English.
[color=blue][color=green]
> >
> > Convey your intent in English (assuming English is your first language)[/color]
>
> wrong assumption, but irrelevant.
>
> Simple concepts are more effectively conveyed thru standard symbols*.
> Fast english readers do not spell out words, or pronounce them in their[/color]
heads.[color=blue]
> Fast code readers do not like to have to read a lot of english, because in[/color]
C[color=blue]
> punctuation conveys more meaning than words.[/color]
"Fast readers" are going to miss something - especially if it is not in the
language they think in.
[color=blue]
>
> while (!done) looks a lot like while(done) or while (idone)
>
> for (;;) is blatantly unambiguous.[/color]
And it has nothing to do with the action/job you're trying to describe.
Write your code so that it describes what the program does.
"Charlie Gordon" <news@chqrlie.o rg> wrote in message
news:df3mnb$l4f $1@reader1.imag inet.fr...[color=blue]
> "Baxter" <lbax02.spamgua rd@baxcode.com> wrote in message
> news:11ha0ubdt7 e1g18@corp.supe rnews.com...[color=green]
> >
> > Why not code it like you would read it in English:
> >
> > bool done = false;
> > while (!done) { // while not done do[/color]
>
> do not paraphrase code in comments.[/color]
I don't - I was illustrating how one would read this in English.
[color=blue][color=green]
> >
> > Convey your intent in English (assuming English is your first language)[/color]
>
> wrong assumption, but irrelevant.
>
> Simple concepts are more effectively conveyed thru standard symbols*.
> Fast english readers do not spell out words, or pronounce them in their[/color]
heads.[color=blue]
> Fast code readers do not like to have to read a lot of english, because in[/color]
C[color=blue]
> punctuation conveys more meaning than words.[/color]
"Fast readers" are going to miss something - especially if it is not in the
language they think in.
[color=blue]
>
> while (!done) looks a lot like while(done) or while (idone)
>
> for (;;) is blatantly unambiguous.[/color]
And it has nothing to do with the action/job you're trying to describe.
Write your code so that it describes what the program does.
Comment