On Friday, 13 June 2014 at 21:41:43 UTC, Jonathan M Davis via
Digitalmars-d wrote:
On Fri, 13 Jun 2014 11:03:14 -0700
"H. S. Teoh via Digitalmars-d" <[email protected]>
wrote:
I disagree, it's not a special case. It's simply a logical
consequence
of each part of the for-loop being optional. Prohibiting
for(;;) would
*be* a special case, because then you're saying that each
component of
the for-loop is optional, *except* when all of them are
omitted.
(Not to mention, for(;1;) is truly an eyesore, far worse than
for(;;).)
It's a special case in that the middle portion is supposed to
be the condition
that the loop use to determine whether it can continue, and
omitting it means
that it has to add the true itself, whereas with the other two
pieces it makes
perfect sense that they'd be optional, since they're not
required to determine
whether the loop needs to terminate. They're just handy helpers.
But this special treatment of the second operand is the same in
all forms of the for loop:
for(int i = 0; ; ++i) // endless loop
Therefore, the fact that `for(;;)` is also an infinite loop is
not an exception.