[fpc-pascal] Untyped var params

Bart bartjunk64 at gmail.com
Sat Jan 7 23:42:01 CET 2017

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

>> But if you know that at forehand (and you know, since you cast it),
>> why then use an untyped var parameter at all?
> http://www.freepascal.org/docs-html/rtl/system/fillchar.html ?

That does not realy answer my question.

It was suggested to do something like this:

procedure X(var Y);
  PInteger(Y)^ := 3;  //syntax may be wrong, too lazy to test

To me this completely defies the purpose of an untyped var parameter,
since in this exmaple you do know, @design time, the type of Y, so why
not write then

procedure X(var Y: Integer);
  Y := 3;

FillChar OTOH _is_ a good example of why you would use an untype var parameter.


More information about the fpc-pascal mailing list