View Issue Details

IDProjectCategoryView StatusLast Update
0033138FPCDocumentationpublic2018-05-14 20:18
ReporterMarco van de VoortAssigned ToMichael Van Canneyt 
PrioritynormalSeverityminorReproducibilityhave not tried
Status closedResolutionfixed 
Product VersionProduct Build 
Target Version3.2.0Fixed in Version3.1.1 
Summary0033138: for in two dimensional array
DescriptionUsing for x in y if y is an two dimensional array of x works fine, but I can't see this possibility mentioned in the docs. (static? Dynamic?)
Steps To Reproduce{$mode delphi}
// compiles in delphi and fpc and prints all elements of array.

type TTestClass = class
            x,y: Integer;
            procedure print;

      TTestclassarray = array[0..10] of ttestclass;

var twod : array[0..3] of TTestclassarray;

procedure TTestClass.print;

var i,j : integer;
    n : TTestClass;
  for i:=0 to 3 do
       for j:=0 to 10 do
  for n in twod do
TagsNo tags attached.
Fixed in Revision1465
Attached Files


Thaddy de Koning

2018-02-08 18:11

reporter   ~0106289

Isn't this side effect of sequential memory layout? But it is neat.

Marco van de Voort

2018-02-08 18:19

manager   ~0106290

It is not really rocket science for a static array indeed. But it should be documented, and orthogonality with dynamic arrays is an interesting case.

Serge Anvarov

2018-02-09 18:11

reporter   ~0106303

The same behavior is in Delphi, and is also not documented in it.

In accordance with, the enumeration classes allow the syntax for using arbitrary function and property names, with their definition as enumerators:
  function StepNext: Boolean; enumerator MoveNext;
  property Value: Integer read FCurrent; enumerator Current;
It's also not documented in

Michael Van Canneyt

2018-02-24 17:03

administrator   ~0106575

Documented. I didn't even know this myself, thanks for the new insights :)

Issue History

Date Modified Username Field Change
2018-02-08 14:29 Marco van de Voort New Issue
2018-02-08 14:29 Marco van de Voort Status new => assigned
2018-02-08 14:29 Marco van de Voort Assigned To => Michael Van Canneyt
2018-02-08 18:11 Thaddy de Koning Note Added: 0106289
2018-02-08 18:19 Marco van de Voort Note Added: 0106290
2018-02-09 18:11 Serge Anvarov Note Added: 0106303
2018-02-24 17:03 Michael Van Canneyt Fixed in Revision => 1465
2018-02-24 17:03 Michael Van Canneyt Note Added: 0106575
2018-02-24 17:03 Michael Van Canneyt Status assigned => resolved
2018-02-24 17:03 Michael Van Canneyt Fixed in Version => 3.1.1
2018-02-24 17:03 Michael Van Canneyt Resolution open => fixed
2018-02-24 17:03 Michael Van Canneyt Target Version => 3.2.0
2018-05-14 20:18 Marco van de Voort Status resolved => closed