Re: [fpc-pascal] Using for-loop index variable after loop

2016-10-10 Thread Virgo Pärna
On Mon, 10 Oct 2016 14:07:35 +0200, Vojtěch Čihák wrote: >       then Break; >   Isn't leaving for loop with break only case, where loop variable will keep the value. Otherwise it is undefined. But it does make the code more confusing. -- Virgo Pärna virgo.pa...@mail.ee

Re: [fpc-pascal] Using for-loop index variable after loop

2016-10-10 Thread Juha Manninen
On Mon, Oct 10, 2016 at 3:07 PM, Vojtěch Čihák wrote: > Hi, if you mean this: > ... Yes, that is one of them. The code does not make sense in any case, regardless of "i"'s value. Index for cActionListEditorUnknownCategory and cActionListEditorAllCategory differ. "i" cannot have both at the same t

Re: [fpc-pascal] Using for-loop index variable after loop

2016-10-10 Thread Vojtěch Čihák
Datum: 10.10.2016 12:16 Předmět: [fpc-pascal] Using for-loop index variable after loop I have always avoided using a for-loop index variable after the loop. I thought its value can be unpredictable in some situations when the compiler reuses its register or memory etc. I noticed the

Re: [fpc-pascal] Using for-loop index variable after loop

2016-10-10 Thread Jonas Maebe
Juha Manninen wrote on Mon, 10 Oct 2016: I have always avoided using a for-loop index variable after the loop. I thought its value can be unpredictable in some situations when the compiler reuses its register or memory etc. That is correct. The compiler, FPC 3.0, does not warn about it. I

[fpc-pascal] Using for-loop index variable after loop

2016-10-10 Thread Juha Manninen
I have always avoided using a for-loop index variable after the loop. I thought its value can be unpredictable in some situations when the compiler reuses its register or memory etc. I noticed the ActionListEditor in Lazarus sources has code that uses it after the loop. The compiler, FPC 3.0, does