[fpc-pascal] Untyped var params

Ryan Joseph ryan at thealchemistguild.com
Sun Jan 8 11:36:22 CET 2017


> On Jan 8, 2017, at 5:22 PM, Sven Barth <pascaldragon at googlemail.com> wrote:
> 
> 1. Why are you trying to assign something to io when you already did
> that with "obj := …"?

I used absolute here so I could know the type of io and not type cast within the function. No good? The idea is I want “io” to be assigned with the value from newObject or set to nil if the input is nil. I know io is a member of TObject but I don’t want type checking when I return the value from the function otherwise all my calls look like RetainObject(TObject(foo), newFoo). It’s a small annoyance but I thought I would take the time to learn Free Pascal more since it always pays off in the end.

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. 

Regards,
	Ryan Joseph




More information about the fpc-pascal mailing list