Jump to content
John Kouraklis

How to pass an unknown record to a function as argument

Recommended Posts

On 2/11/2019 at 8:18 PM, Attila Kovacs said:

Like me. It's "created" once at startup to generate the rtti cache and stored in a global variable and never "created" again or "free"'d. Single threaded app.

 

TRTTIContext doesn't have to be freed. To quote the help:

Quote

Note: A call to Free is not necessary because the instance is released when the TRttiContext gets out of scope.

Share this post


Link to post
1 hour ago, Rudy Velthuis said:

Not much, as this is only one function. And it is more elegant than passing a pointer and type info.

 

I would then make this function call a private function with the pointer obtained from the parameter and the typeinfo obtained from T.

 

That way, there will hardly be any bloat. And if this function is not critical, you will never notice a difference.

That's exactly what I suggested if you read on to the second paragraph. 

Share this post


Link to post
4 hours ago, David Heffernan said:

That's exactly what I suggested if you read on to the second paragraph. 

Yes, indeed you did. I must have missed that, sorry.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×