[fpc-pascal] Untyped var params

Bart bartjunk64 at gmail.com
Sun Jan 8 00:53:58 CET 2017


On 1/8/17, Dmitry Boyarintsev <skalogryz.lists at gmail.com> wrote:

> Think about something like a var-type variable, where the actual type of Y
> might vary.
>
> procedure XX(var Y; YType: integer);
> begin
>   case YType  of
>     T_INT: PInteger(@Y)^:= 3;
>     T_SINGLE: PSingle(@Y)^:=3;
>     T_DOUBLE: PDouble(@Y)^:=3;
>   end;
> end;

OK, I can imagine more complex examples where this may come in handy.

And thanks for the rest of the explanation.

Bart



More information about the fpc-pascal mailing list