[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Numeric for loop: Changing control variable REALLY dangerous?
- From: Roberto Ierusalimschy <roberto@...>
- Date: Mon, 12 Dec 2022 09:48:42 -0300
> After the comments above of Francisco, I interprete it as safe to
> interprete the warning in the reference manual more like "It is safe
> to vary the counter loop variable inside the for loop limits, but any
> new value outside the for loop might lead to undefined behaviour." ...
> I hope I will survive this and not run into explosions :).
- It is possible that the next Lua version will operate directly with
the loop variable, without any internal copy.
- It is possible that, in the next Lua version, the loop control
variable will be implicit declared as <const> to make the above change
safer.
-- Roberto