I feel like a beginner when I say that I've never used advanced records or
enumerators before, or the "for-in" loop. There's definite room for
improvement there though, for sure.
I think the problem with the compiler is that it seeks to keep the record
together in concurrent storage. Storing
There's not really any way to do what that does with a normal for loop
without copying the array though, which is whole point basically.
Here's the actual assembly I get from FPC for "main":
.section .text.n_main,"x"
.balign 16,0x90
.globl PASCALMAIN
PASCALMAIN:
.globl main
main:
.Lc12:
Hi,
The trick with enumerators is to never make them classes, and use
advanced records instead, I've found. This way you avoid the heap
allocation and the implicit try/finally. Also make sure you inline the
MoveNext and GetCurrent!
that's what I do.
But the generated assembly is still
On Fri, Feb 22, 2019 at 1:07 AM Paul van Helden
wrote:
> How do you make a (for in) enumerator with a record? I don't use them for
> exactly this reason, and they did seem to be another useful language
> feature that turned out to be poorly implemented by Embarcadero. (Haven't
> checked with