OT: for (;;) {} vs while (true) {}
Dennis Ritchie via Digitalmars-d
digitalmars-d at puremagic.com
Fri Nov 25 04:53:13 PST 2016
On Friday, 25 November 2016 at 11:20:24 UTC, Jonathan M Davis
wrote:
> Probably the complete lack of a condition to test in for(;;). I
> confess that I was shocked when I found out that it was legal
> to have a for loop without a condition. That seems like doing
> while() or if(), which makes no sense. So, I never use for(;;)
> and wish that it didn't exist, but it does, and some folks use
> it. So, I have to live with the possiblity of dealing with it
> when dealing with code written by other people. But I won't
> ever use it.
IMO, it is very convenient for system programming guru. It is
believed that it came from the K&R.
For example, this option is definitely very convenient to use:
https://github.com/dlang/phobos/blob/master/std/algorithm/comparison.d#L591
More information about the Digitalmars-d
mailing list