Sven Sahle wrote:
Hello,
while working with schemata in gpc I encountered a problem:
In the following program it seems the "array of vektor" a^ is created with the correct size but the components of the array do not know about their own size. I do not know if this is the expected behaviour. May be the compiler should either not allow this construct or otherwise initialize the array.
TYPE vektor(n: Integer)=array[0..n-1]of double;
vektorarray(n: Integer)=array[1..100]of vektor(n);
VAR a: ^vektorarray;
BEGIN new(a, 3);
WriteLn(a^.n); { gives 3 } WriteLn(a^[10].n); { gives 0, should it be 3 ? }
WriteLn(Sizeof(a^) ); {Writeln(Sizeof(a^[10]) );} {would result in compiler error " `SizeOf' applied to an undiscriminated schema " } END.
The output is:
3 0 2804
I am using gpc version 19991030, based on 2.95.2 19991024 (release)
Thanks for the bug report. The second problem has been fixed in more recnt versions like Russ said, the first one not yet. (sven19.pas)
Frank