Lazarus

Programming => Graphics => Graphics and Multimedia => BGRABitmap and LazPaint => Topic started by: SudoKai on April 26, 2019, 09:36:24 pm

Title: Compile error
Post by: SudoKai on April 26, 2019, 09:36:24 pm
One of my applications triggered a 'Wrong number of parameters specified for call to "Length"' compile error.

My very old installation of Lazarus 1.4.0 does not trigger this compile error, but Lazarus 2.0.2 does.

Below is some test code:

Code: Pascal  [Select]
  1. uses
  2.  BGRABitmapTypes;
  3.  
  4. Procedure TForm1.Set_Length;
  5. Var
  6.  Loop: Integer;
  7.  Array_of_TPointF: Array[0..5] of TPointF;
  8.  Array_of_Integer: Array[0..5] of Integer;
  9. Begin
  10.  With Array_of_TPointF[0] do
  11.   For Loop := 0 to Length(Array_of_Integer)-1 do
  12. end;
Title: Re: Compile error
Post by: howardpc on April 26, 2019, 10:15:02 pm
Better would be the following which avoids Length() altogether:

Code: Pascal  [Select]
  1.      ...
  2.      for Loop := Low(Array_of_Integer) to High(Array_of_Integer) do
  3.      ...
Title: Re: Compile error
Post by: SudoKai on April 26, 2019, 10:47:31 pm
Only the x,y variables are supposed to be visible with TPointF, yet the identifier completion (Ctrl+space) lists procedures and functions as well.
Title: Re: Compile error
Post by: marcov on April 26, 2019, 11:36:45 pm
Only the x,y variables are supposed to be visible with TPointF, yet the identifier completion (Ctrl+space) lists procedures and functions as well.

Later Delphi's add methods, and so does FPC. I think 3.0 for the non floating point records, and 3.0.4 for the floating point ones.
Title: Re: Compile error
Post by: SudoKai on April 27, 2019, 09:26:02 am
Thank you for the feedback thus far. I will try the Low and High suggestion.

Seems I have to be careful with Lazarus 2.0.2 as I can get into trouble real quick real fast.