cobines wrote:
2012/4/22 Mark Morgan Lloyd <markmll.fpc-pas...@telemetry.co.uk>:
 but I'm not sure why that works when it
didn't earlier (i.e. before I'd started using array of const).

You said you used
DbgArray= array of integer

then I assume this declaration?
procedure ClrDebug(const panels: DbgArray);

If so the parameter is a dynamic array not open array and you cannot
call it with constant array:

var
  arr: DbgArray;
begin
 ClrDebug([DbgKey, DbgCode1, DbgTx]); //Won't work
 SetLength(arr, ...);
 arr[0] := ...
 ...
 ClrDebug(arr);// This works
end;


This on the other hand is an open array parameter:
procedure ClrDebug(const panels: array of integer);

Thanks, succinct. So if I understand this correctly it's one of the very rare cases where one has to write out the type of a parameter in full, rather than using an earlier declaration.

--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to