[fpc-pascal]Minimum size of parameters

Aitor Santamaria Merino aitor.sm at wanadoo.es
Thu Dec 6 17:42:37 CET 2001

Many thanks for the piece of advice.
Two more problems:

> On donderdag, december 6, 2001, at 04:47 , Aitor Santamaria Merino wrote:
>> If the answer to the previous was NO, then do you have another idea to 
>> solve my initial problem, execute this:
>>      Pt: PointerToCertainProcedure;
>>      Sz: SizeInBytesOfProcedureArgs;
>>      Arg: PointerToARecordContainingArgs;
>> END;

This would be, then
      Pt: Procedure (args: array of const);
      Arg: args;

Problem 1) This wouldn't be transparent for procedures/functions, and it 
is my wish that it should be so.
Ok, I could wrap it...

> Pascal (Delphi-style pascal) has a generic solution for this. It's 
> called an "array of const". You use it like this:
> ***
> procedure p(args: array of const);
> var
>   i: longint;
> begin
>   for i := low(args) to high(args) do
>     case args[i].vtype of
>       vtInteger:
>         writeln(args[i].vInteger);
>       ...
>     end;
> end;
> begin
>   p(["string",'c',1354]);
> end.
> ***

Problem 2) How would I fill into such structure? Could I do
Var A: args;

      a[1] := 'string';  {why "?}
      a[2] := 'c';
      a[3] := 1234;

Problem 3) Which are the fields of a[i]? You seemed to mention vtype, 

> I suppose this is all explained in the reference manual, though I'm not 
> sure.

I coulnd't find it as a first glance... (I looked at the open arrays 
section, although my compiler version is still rather outdated...


More information about the fpc-pascal mailing list