Re: what does two semicolns ';;' do



..oO(Tim Streater)

In article <ivgh64ll18rvnv95q6noc13cadab4r17uh@xxxxxxx>,
Michael Fesser <netizen@xxxxxx> wrote:

Pest or cholera. You also have to use a break to leave the while loop.
IMHO infinite loops are always ugly and bad coding style, regardless of
how you code them.

Not necessarily. I would always use while (true), as then you make
explicit what you are doing. Secondly, sure you have to break out of the
loop. But suppose there's a number of different reasons to do so? You're
not necessarily going to be able to choose one as the "main driver" of
the loop, which ought then to migrate into the loop construct?

You could still find a better way to express the loop condition, even if
it's just a variable:

while (!$workIsDone) {
...
}

I admit that I also use break/continue from time to time, but I try to
avoid them because they often lead to hard to understand spaghetti code.
There's almost always a better way to structure the code.

Micha
.



Relevant Pages

  • Re: Race condition in mb_free_ext()?
    ... Your suggestion will always enter the loop and do the atomic ... Regardless, though, the livelock itself, assuming it ... (before the 'dofree' variable was introduced there). ...
    (freebsd-net)
  • Re: Modyfying loop?
    ... > regardless of how many link items or hash arrays are added to the menu ... > be included in their right places, so the loop would print the following? ...
    (comp.lang.perl.misc)
  • Re: for loops
    ... I personally would never use a FOR ENDFOR loop for something that I do not ... and such constructs lets one think the programmer wasnt able to create ... > regardless of which programming-language i worked in. ... > Using EXIT breaks the structured program-flow. ...
    (microsoft.public.fox.programmer.exchange)
  • Re: Assignment and comparison in one statement
    ... "Python way" of doing this kind of thing? ... should do regardless of the language, ... Then try to write the ``while`` loop as ``for`` loop and move the ...
    (comp.lang.python)
  • Re: Race condition in mb_free_ext()?
    ... > Your suggestion will always enter the loop and do the atomic ... > regardless of what dofree is set to above that code (not shown in ... > is due to a long time being spent spinning in the above loop, ...
    (freebsd-net)