[fpc-devel] const parameter passing
Jonas Maebe
jonas.maebe at elis.ugent.be
Thu Mar 17 11:21:15 CET 2011
On 17 Mar 2011, at 10:11, Martin Schreiber wrote:
> Byvalue or byreference for const parameters is defined in Delphi 7
> language
> manual on page 12-1, it seems the documentation has not been changed
> much:
> http://docs.embarcadero.com/products/rad_studio/delphiAndcpp2009/HelpUpdate2/EN/html/devcommon/programcontrolov_xml.html
That documentation seems to be incorrect for records at least. It says:
" Value and constant (const) parameters are passed by value or by
reference, depending on the type and size of the parameter:
...
An exception to this rule is that records are always passed directly
on the stack under the cdecl, stdcall, and safecall conventions"
The entire reason we introduced the "constref" modifier was because
const records appear to be always passed by *reference* if you use
stdcall under Delphi.
And with 64 bit, some things change for Delphi: http://twitter.com/kylix_rd/statuses/48209068124422144
The other remark from Allen Bauer I posted was in reply to someone who
complained about this.
Jonas
More information about the fpc-devel
mailing list