[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: New warning from compiler about loop variables
[Thread Prev] | [Thread Next]
- Subject: Re: New warning from compiler about loop variables
- From: Jussi Lahtinen <jussi.lahtinen@xxxxxxxxx>
- Date: Tue, 29 Sep 2026 18:17:35 +0300
- To: Gambas Mailing List <user@xxxxxxxxxxxxxxxxxxxxxx>
Ah, of course. You are right, it should give a warning. Or not allow to declare the variable again. Jussi On Tue, 29 Sep 2026, 16:48 brian, <brian@xxxxxxxxxxxxxxxx> wrote: > The issue is if you declare a var and use it for something . And then by > accident use and declare the same one in a loop. There was no error or > warning you are left debugging .... > Guilty as myself of that. Every other language would make that an error. > > > On September 29, 2026 3:31:56 AM PDT, Jussi Lahtinen < > jussi.lahtinen@xxxxxxxxx> wrote: > >> >> For X as Integer = 1 to 12 ' X is declared as a *new Integer local to the loop* >>> do something >>> Next >>> Print X ' Prints 123 >>> >>> >> I don't think so... At least the memory address do not change and thus >> what would be the issue? >> >> Dim n As Integer >> Print "initial; ";; VarPtr(n) >> >> For n As Integer = 0 To 0 >> Print "inside; ";; VarPtr(n) >> Next >> >> Print "at the end; ";; VarPtr(n) >> >> >> Jussi >> >>> ~~~Brian >
| Re: New warning from compiler about loop variables | Lee <t.lee.davidson@xxxxxxxxx> |
| New warning from compiler about loop variables | Brian G <brian@xxxxxxxxxxxxxxxx> |
| Re: New warning from compiler about loop variables | Lee <t.lee.davidson@xxxxxxxxx> |
| Re: New warning from compiler about loop variables | BB <adamnt42@xxxxxxxxx> |
| Re: New warning from compiler about loop variables | Jussi Lahtinen <jussi.lahtinen@xxxxxxxxx> |
| Re: New warning from compiler about loop variables | brian <brian@xxxxxxxxxxxxxxxx> |