Lazarus
Free Pascal => General => Topic started by: Fred vS on April 09, 2014, 01:53:25 am
-
Hello.
I have some trouble with array :
type
...
TDArFloat = array of cfloat;
TDArPARFloat = array of TDArFloat;
TDArIARFloat = array of TDArPARFloat;
....
var
mymultiarray : TDArIARFloat ;
When i use that code with fpc 2.7.1 => perfect, no problem :
setlength(mymultiarray,1) ;
setlength(mymultiarray[0], 1) ;
setlength(mymultiarray[0].[0],1) ;
But with fpc 2.6.2 i have that error message :
setlength(mymultiarray[0].[0],1)
Error: Illegal qualifier
What must i do to be fpc 2.6/2.7 compatible ?
Many thanks.
Fred
-
Maybe SetLength(mymultiarray[0, 0], 1);?
-
SetLength(mymultiarray[0, 0], 1);
=>
Error: Incompatible types: got "Set Of Byte" expected "Int64"
-
From an example from the docs (http://www.freepascal.org/docs-html/ref/refsu18.html#x42-460003.3.1):
SetLength(mymultiarray, 1, 1, 1);
-
@ engkin : Many thanks.
Aaargh, lot of code to change and...
with SetLength(mymultiarray, 1, 1, 1), it set length for each array.
With the fpc 2.7.1 syntax, you can set only the length of last array.
Or maybe does it exist something like : SetLength(mymultiarray, -1, -1, 3) but i do not find it in doc ;)
-
setlength(mymultiarray[0].[0],1)
Why the "." ?
Should it not be
setlength(mymultiarray[0][0],1)
-
@ Martin_fr => more than ever => brillantissimo ;)
setlength(mymultiarray[0][0],1)
Did the trick ;D
Many thanks.
(and now re-change all my code :-X )
PS : Strange that setlength(mymultiarray[0].[0],1) works perfectly with 2.7.1.
-
http://bugs.freepascal.org/view.php?id=26016