News for hackers. Stuff that matters.
Re:C uses "&" for the address-operator because 'ampersand so... by nyssos on Tuesday October 10, 2023 @11:22AM (#37833237)
> In other languages at that time the for loop was written in terms of a range, but without a strong range abstraction such loop is really primitive and limited in applicability.

That's a good thing: it gives you a clear syntactic marker for "this loop definitely terminates". There's already a full power anything-goes looping construct: `while`.

Re:C uses "&" for the address-operator because 'ampersand so... by professoretc on Tuesday October 10, 2023 @12:15PM (#37834069)
But `while` doesn't restrict the scope of the variable(s) to just the loop. I believe there was a proposal to add

    while(int i = 0; i < 100) { ... }
as a valid syntax to C++ (which would restrict the scope of i to the loop), as you can already do

    if(int i = f(); i > 0) { ... }
but it didn't go anywhere.
Re:C uses "&" for the address-operator because 'ampersand so... by a_e_k on Tuesday October 10, 2023 @01:00PM (#37834617)
I'd just use a for with an empty update clause for that:

    for (int i = 0; i < 100; ) { ... }