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



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.
.



Relevant Pages

  • Re: Method ***** not found. Warning displayed in Form1.cs [Design] pane
    ... Warning message: Method 'System.Windows.Forms.Form.DisplayMessage' not ... The file where you're trying to add the call site to your new method is a special file: in addition to being compiled by the C# compiler to create your Form sub-class, it is parsed by the Visual Studio Designer as part of showing you the graphical representation of the object and allowing you to edit it. ... If the Designer comes across something it doesn't recognize, it has no way to know what to do with it. ... It's possible that you should simply call the method from your own construction, after the call to InitializeComponent, or that you should override the OnFormLoador OnShownmethods and call the method in the override. ...
    (microsoft.public.dotnet.languages.csharp)
  • Compiler positions available for week ending August 13
    ... Plan and architect code development and productivity tools. ... Compiler development and optimization background. ... GrammaTech is seeking a Software Engineer to become an integral part ... is a market leader in graphics and digital media ...
    (comp.compilers)
  • Re: Getting the lr register in a C subroutine
    ... you can't do this in ADS without assembler. ... > The compiler can place the return address whereever it wants, ... The routine I would create is a controled one and all it will do is get ... about happens here, the only problem is the warning message, that to me ...
    (comp.sys.arm)
  • Compiler Warning C4373 about virtual methods
    ... The following code will result in C4373 warning message. ... What means "bind"? ... either the base or derived class. ... Versions of the compiler prior to Visual C++ 2008 bind the function to the ...
    (microsoft.public.vc.language)
  • Re: Flash to JOG
    ... Turbo-Pascal was $99 for a compiler with a complete IDE. ... Another big thing Kahn did was popularize the IDE, the lack of which had been one unspoken productivity excuse for many years by informal guilds of batch-oriented developers, on all platforms, mainframe, Unix and micro's. ...
    (comp.databases.theory)