[fpc-pascal] function param and TVarRec

Xiangrong Fang xrfang at gmail.com
Tue Sep 24 08:46:56 CEST 2013


Hi There,

If you declare this:

procedure proc(param: array of const);

Then you can pass any type of varaible to param, however, only in an array,
such as proc([1, 2]);

Is it possible to achieve the effect of the code below (which is wrong):

procedure proc(p1: const; p2: const);

So that: 1) p1 and p2 is translated by the compiler to TVarRec inside the
function; 2) I do not need to pass an array to the function, in another
word, the number of params for the procedure is *fixed*, but the *type* of
each param is not.

Regards,
Xiangrong
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20130924/1118736a/attachment.html>


More information about the fpc-pascal mailing list