[fpc-pascal] Untyped var params

Ryan Joseph ryan at thealchemistguild.com
Sun Jan 8 11:41:31 CET 2017


> On Jan 8, 2017, at 5:36 PM, Ryan Joseph <ryan at thealchemistguild.com> wrote:
> 
> Casting TObject(input) := obj; worked but the value of “io” is still not getting set. Because it’s a var I expected the value to be returned to the caller. 

Never mind, I got it working, stupid mistake in my testing.

yes just like that function. I just learned about absolute so I was making us of it. Seems to work the same as casting in FreeAndNil. Thanks for helping.

    procedure FreeAndNil(var obj);
      var
        temp: tobject;
      begin
        temp:=tobject(obj);
        pointer(obj):=nil;
        temp.free;
      end;


Regards,
	Ryan Joseph




More information about the fpc-pascal mailing list