Recent

Author Topic: Array of array of array problem...  (Read 4102 times)

Fred vS

  • Hero Member
  • *****
  • Posts: 1671
    • miXimum is the DJ's best friend
Array of array of array problem...
« on: April 09, 2014, 01:53:25 am »
Hello.
I have some trouble with array :

Code: [Select]
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 :
Code: [Select]
setlength(mymultiarray,1) ;
 setlength(mymultiarray[0], 1) ;
  setlength(mymultiarray[0].[0],1) ;
 

But with fpc 2.6.2 i have that error  message :
Quote
setlength(mymultiarray[0].[0],1)
 Error: Illegal qualifier

What must i do to be fpc 2.6/2.7 compatible ?

Many thanks.

Fred
I use Lazarus 1.8.0 32/64 and FPC 3.0.3 32/64 on Linux Mint Mate 17 32/64, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64 and Mac OS X Snow Leopard 32.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt, Carbon.

https://github.com/fredvs

engkin

  • Hero Member
  • *****
  • Posts: 2510
Re: Array of array of array problem...
« Reply #1 on: April 09, 2014, 01:59:38 am »
Maybe SetLength(mymultiarray[0, 0], 1);?

Fred vS

  • Hero Member
  • *****
  • Posts: 1671
    • miXimum is the DJ's best friend
Re: Array of array of array problem...
« Reply #2 on: April 09, 2014, 02:02:45 am »
Code: [Select]
SetLength(mymultiarray[0, 0], 1);=>
Quote
Error: Incompatible types: got "Set Of Byte" expected "Int64"
I use Lazarus 1.8.0 32/64 and FPC 3.0.3 32/64 on Linux Mint Mate 17 32/64, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64 and Mac OS X Snow Leopard 32.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt, Carbon.

https://github.com/fredvs

engkin

  • Hero Member
  • *****
  • Posts: 2510
Re: Array of array of array problem...
« Reply #3 on: April 09, 2014, 02:17:09 am »
From an example from the docs:
SetLength(mymultiarray, 1, 1, 1);

Fred vS

  • Hero Member
  • *****
  • Posts: 1671
    • miXimum is the DJ's best friend
Re: Array of array of array problem...
« Reply #4 on: April 09, 2014, 04:48:47 am »
@ 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  ;)
I use Lazarus 1.8.0 32/64 and FPC 3.0.3 32/64 on Linux Mint Mate 17 32/64, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64 and Mac OS X Snow Leopard 32.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt, Carbon.

https://github.com/fredvs

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 5454
    • wiki
Re: Array of array of array problem...
« Reply #5 on: April 09, 2014, 05:26:29 am »
Code: [Select]
setlength(mymultiarray[0].[0],1)

Why the "." ?

Should it not be
Code: [Select]
setlength(mymultiarray[0][0],1)

Fred vS

  • Hero Member
  • *****
  • Posts: 1671
    • miXimum is the DJ's best friend
Re: Array of array of array problem...
« Reply #6 on: April 09, 2014, 11:57:47 am »
@ Martin_fr => more than ever => brillantissimo  ;)

Code: [Select]
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.
I use Lazarus 1.8.0 32/64 and FPC 3.0.3 32/64 on Linux Mint Mate 17 32/64, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64 and Mac OS X Snow Leopard 32.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt, Carbon.

https://github.com/fredvs

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 5454
    • wiki