[fpc-pascal] How to pass an array of bytes directly in a TBytes param?

Dmitry Boyarintsev skalogryz.lists at gmail.com
Sat Feb 20 02:37:28 CET 2016


procedure test(const b: array of byte) ??

On Friday, February 19, 2016, silvioprog <silvioprog at gmail.com> wrote:

> Hello,
>
> Consider the following procedure:
>
> procedure test(b: TBytes);
> begin
> end;
>
> The common way to pass an array of bytes in this procedure is declaring
> and initializing a TBytes variable. But in Delphi (XE) I just do:
>
>   test([65, 66, 67]);
>
> However, when I try it on FPC (trunk), I get:
>
> "Error: Incompatible type for arg no. 1: Got "{Array Of Const/Constant
> Open} Array of ShortInt", expected "TBytes"".
>
> Is this feature supported in FPC? If so, how to use that?!
>
> Thank you!
>
> --
> Silvio Clécio
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20160219/36cee345/attachment.html>


More information about the fpc-pascal mailing list