[fpc-pascal] Passing static arrays to open arrays

Ryan Joseph genericptr at gmail.com
Wed Mar 4 12:42:18 CET 2020


Here's another issue I found with open arrays. Why isn't the static array of NSArray compatible with "array of pointer"? You can assign NSArray to pointer so why is the open array different?

===========

{$mode objfpc}
{$modeswitch objectivec2}

program test;
uses
  CocoaAll;

procedure Test(input: array of pointer); 
begin
end;

var
  list: array[0..10] of NSArray;
  p: pointer;
begin
  // no problem!
  p := list[0];
  // Incompatible type for arg no. 1: Got "Array[0..10] Of NSArray", expected "{Open} Array Of Pointer"
  Test(list);
end.


Regards,
	Ryan Joseph



More information about the fpc-pascal mailing list