In Macpas mode, you can specify a UNIV (universal) parameter. This signifies that any parameter with the exact same byte size as the declared parameter can be passed as the value of the parameter: Given the following procedure declaration:
procedure HDispose( var theHandle: univ Handle);
You can pass value of any type that has the same size as Handle.
This comes in especially handy for typed procedures. Given the following definition:
Type TComparer = function (theIndex: Int32; theValuePtr : univ Pointer): boolean; function Find( theValuePtr : univ UnivPtr; theFirstIndex : Int32; theLastIndex : Int32; SmallerThan : TComparer; EqualTo : TComparer; var theFoundIndex : Int32): boolean;
You can call Find as follows
Result:=Find(@theCmdID,1,kCmdCount,IsSmallerThan, IsEqualTo,aIndex):
Where the two functions IsSmallerThan and IsEqualTo are defined as:
function IsSmallerThan(theIndex : Int32; aPtr : PtrInt): boolean; function IsEqualTo(theIndex : Int32; aPtr : PtrInt): boolean
Because PtrInt has the same size as Pointer, this will compile.