Re:C++17 Is Here: Interview with Herb Sutter
by flavio81 on Tuesday October 24, 2017 @09:07AM
(#15541217)
For(;;) allows you to put the looping variable initialization, exit condition, and increment statement in the same line, so you easily get a clear idea of those three.
[ Parent
| on HN ]
Re:C++17 Is Here: Interview with Herb Sutter
by gumby on Tuesday October 24, 2017 @02:00PM
(#15543682)
I don't know why this got downvoted; true, I was referring to the infinite loop case, but this is a legit (if not C++-specific) case of a benefit of for over while.
Likewise do...while is in retrospect, a mistake, because it documents the control strategy in a bad place from a humans-understanding-code point of view.
Re:C++17 Is Here: Interview with Herb Sutter
by flavio81 on Tuesday October 24, 2017 @03:32PM
(#15544512)
>I don't know why this got downvoted; true, I was referring to the infinite loop case, but this is a legit (if not C++-specific) case of a benefit of for over while.
Thanks gumby.
I simply didn't catch that they were referring only to infinite loops. I though they were debating the usefulness of while versus for, in general.