[fpc-devel] constref in Windows

Hans-Peter Diettrich DrDiettrich1 at aol.com
Sat Nov 20 19:10:24 CET 2010

Jonas Maebe schrieb:

>> Const is a pascal keyword which can mean for pascal "pass records
>> by reference".
> Making it mean that would make a lot of code less efficient. It
> doesn't have that meaning for the i386 "register" calling convention
> either (and it cannot be made to mean that there, because that would
> break Delphi compatibility).

AFAIR Delphi treats the byval/byref issue as "compiler specific", so 
nothing can be broken - apart from code that is bound to an specific 

>> If you need to pass a record by value to some system C routine then
>> don't mark that argument as const during the header convertion.
>> What is wrong?

A const record cannot be passed as a non-const parameter. This is the 
only difference between constref and var. Thus "const var" could have 
been used instead of a new "constref" keyword.


More information about the fpc-devel mailing list