lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Mon, 2022-12-12 at 06:15 +0100, bil til wrote:
>
> 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." ...

No, this is not given to you by the manual. _Any_ modification of
the control variable, including assignments of "in-range" values,
need not be supported, and could affect execution of the program
in arbitrary ways that you don't expect.

Just don't, OK? If you need semantics that is not supported by
a given instruction, then pick another instruction which does
provide what you need.

Or: Do it and accept the risk. Don't complain. Don't claim that
it'd be supported when it's not. And documentedly is not.

It's that simple. And is not specific to Lua, applies to any
programming language.


virtually yours
Gerhard Sittig
--
     If you don't understand or are scared by any of the above
             ask your parents or an adult to help you.