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



"Baxter" <lbax02.spamguard@xxxxxxxxxxx> wrote in message
news:11ha0ubdt7e1g18@xxxxxxxxxxxxxxxxxxxxx
>
> Why not code it like you would read it in English:
>
> bool done = false;
> while (!done) { // while not done do

do not paraphrase code in comments.

>
> bool mainloop = true;

you probably want to make this a const

> while (mainloop) { // while mainloop do

useless comments are a pain.

> ...
>
>
> You can further document it like this:
> while (!done) { // will never be done while computer is running

why require so many words for something so simple?

How much commenting will you resort to the really complicated stuff?

> ...
>
> There's many variations on this:
>
> #define NOTDONE 1
> ...
> while (NOTDONE) {
> ...
>
> Convey your intent in English (assuming English is your first language)

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 heads.
Fast code readers do not like to have to read a lot of english, because in C
punctuation conveys more meaning than words.

while (!done) looks a lot like while(done) or while (idone)

for (;;) is blatantly unambiguous.

Chqrlie.

*: this is a requirement in multicultural areas, road signs are a good example:
they are not used so much in the US, where everything is written, sometimes even
abbreviated beyond repair (what is a PED XING? where is B'WY/NY?)


.



Relevant Pages

  • Dictionary in NetSpell
    ... I've found NetSpell API package which is ... it tells me if a word is in an English dictionary (because its return ... type is bool). ... I start to doubt if the "SpellCheck" method is what I think ...
    (microsoft.public.dotnet.general)
  • Re: Shortcut key conflicts with RichText control
    ... > Hi, folks ... btw... ... Is there an English version of that page ... BOOL bPlatformSupportsSideBySide'turns red in VB so it can't be ...
    (microsoft.public.vb.controls)
  • =?utf-8?Q?Re:_Obama=E2=80=99s_Use_of_Complete_Sent?= =?utf-8?Q?ences_Stirs_Controversy?=
    ... If you can successfully covey that messsage by not using what an english teacher would say is the proper use of that language, that is what counts in the end. ... You can use proper english, and still not be able to convey what you meant to convey, which should that happen, does no good at all to say that at least you used the proper form of english when you attempted to convey that message. ... Obama has broken with a tradition established over the last eight ... Millions of Americans who watched Mr. Obama's appearance on CBS's ...
    (soc.retirement)
  • Re: Everything u can think of 2 help a puter illiterate
    ... There's nothing wrong when using chat methodology communication typing ... to convey a similar vocal conversation speed. ... actually write and type English, grammatically correct, anymore. ...
    (microsoft.public.windowsxp.newusers)
  • Re: UKRM-London branch drinks evening: 25th May 2007
    ... However, the "Y" is merely an attempt to convey the letter Thorn, Þ, ... which represented the "th" digraph in Old English, ... English as it pertains to City pubs, you should have better things to ...
    (uk.rec.motorcycles)