[fpc-pascal] Access to RS232 ports with fpc

Frank Peelo f26p at eircom.net
Mon Nov 2 11:41:31 CET 2009

J├╝rgen Hestermann schrieb:

> function SerRead(Handle: TSerialHandle; var Buffer; Count: LongInt): 
> LongInt;
>    begin
>    Result := fpRead(Handle, Buffer, Count);
>    end;
> i don't understand the declaration for "buffer" in the function 
> below, because no type is declared for "buffer". 

Untyped parameters date back to early TurboPascal.


     Variable and constant parameters can be untyped. In that case the
     variable has no type, and hence is incompatible with all other
     types. However, the address operator can be used on it, or it can be
     can passed to a function that has also an untyped parameter. If an
     untyped parameter is used in an assigment, or a value must be
     assigned to it, a typecast must be used.

This can be used when you create a variable to use as a block of memory, 
for a buffer. The size of the buffer has to be known to the function, so 
it would typically be passed in as a parameter.

I'd guess the reason for adding these to the language is that the caller 
has to have a variable to pass, so you are less likely to pass an 
invalid pointer, i.e. one which has not been set to point at allocated 


More information about the fpc-pascal mailing list