[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Numeric for loop: Changing control variable REALLY dangerous?
- From: Francisco Olarte <folarte@...>
- Date: Sun, 11 Dec 2022 12:14:08 +0100
On Sun, 11 Dec 2022 at 07:50, bil til <email@example.com> wrote:
> ... yes of course ... this would be bad... but this was not my
> question. (it is clear to me that you have to do such counter variable
> changes with some care... (I am an experienced C programmer - no only
> in "full stuffed Visual Studio C", but also in "less fool-proof"
> microcontroller C variants... :) ).
Bear in mind C does NOT have counted for loops (AFAIK, not keeping too
current with the last standards ), C for is a kind of super-while.
Experience with fortran, basic or any of the other languages which DO
have them will be more appropriate.
Modifying the "control variable" in a classic C counted loop <<
for(i=start; i<endplus1; ++i ) >> is perfectly defined in C, and used
and abused everywhere. I have not used it too much in the last 25
years, but before good optimizers I used it for microoptimizations
every now and then.