[fpc-pascal] Dynamic array as result of class method?

Wimpie Nortje wimpienortje at gmail.com
Sun Nov 7 13:21:06 CET 2010


TByteDynArray is defined in unit 'types'

On 2010/11/07 12:23 PM, Jonas Maebe wrote:
> 
> On 07 Nov 2010, at 11:05, Bo Berglund wrote:
> 
>>    function Read(Count: Cardinal): array of byte; overload;
>>  end;
>>
>> But when I use the Ctrl-Shift-C command on this to make Lazarus
>> complete the code I get an error on the second Read line:
>> sscomm.pas(40,37) Error: identifier expected, but array found
>>
>> Is it illegal to specify a dynamic array as the result type of a
>> function?
> 
> No, but you cannot declare it inline, just like you cannot have
> 
> function read(count: cardinal): record b: byte end;
> 
> Use a separately defined type:
> 
> type
>   tbytearray = array of byte;
> 
> 
> Jonas
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
> 



More information about the fpc-pascal mailing list