News for hackers. Stuff that matters.
Re:C uses "&" for the address-operator because 'ampersand so... by adrian_b on Tuesday October 10, 2023 @02:14PM (#37835491)
Before C and Alphard, all the "for" loops had control variables that took all values of some arithmetic progression.

Even today, such simple loops with arithmetic progressions include an overwhelming majority of all "for" loops.

The C syntax made writing these simple "for" loops more difficult, by having to write a lot of redundant symbols, instead of writing the minimum number of separators. Also for reading, the redundant symbols obscure the meaningful text.

The C syntax allows the writing of "for" loops where the values of the control variables are not taken from a progression, but they are for instance the values of the links of a linked list.

This kind of "for" loops can be written in a simple way by using iterators, without complicating the syntax of the loops with simple arithmetic progressions.

In modern C++ there is no longer any case when you would want to use the C kind of "for", but the kinds of loops used by languages like C++ already existed in languages introduced at about the same time with C, e.g. Alphard and Clu.

There are no comments on this comment yet.