Delphi constants and references

Posted by Sambatyon on Stack Overflow See other posts from Stack Overflow or by Sambatyon
Published on 2010-03-24T10:36:38Z Indexed on 2010/03/24 14:03 UTC
Read the original article Hit count: 272

I want to pass constant references to functions in delphi, so I am sure that the referenced object won't change and to save time and memory. So I want to declare a function like

function foo(var const Value : Bar) : Boolean;

however this is not allowed. I thought constant values would be automatically sent as references. However I found out that it is not the case (getting the address of an object before sending it to the function gives me $12F50C and the address of the same object inside the function is $12F564)

What can I do to send constant references?

© Stack Overflow or respective owner

Related posts about delphi-2007

Related posts about pass-by-reference