This program:

Program TestMem ;
Const ASize = 1000 ;
Type DataA = Array Of Longint ;
Var A : DataA ;
Procedure Init(Out X : DataA ; Const N : Longint) ;
Begin
  Writeln(Length(X)) ; { Writes: 0 }
End ;
Begin
  SetLength(A, ASize) ;
  Writeln(Length(A)) ; { Writes: 1000 as expected }
  Init(A, ASize) ;
End.

gives the results noted in the comments.
The correct results are obtained if
1) I substitute "Var" for "Out". This leads to the warning that X is not
initialized.
2) I substitute "Array Of Longint" for "DataA".
What am I doing wrong this time?

Andrew Bennett

 
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to