Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2011-03

const parameter passing

4 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Martin Schreiber
to Jonas Maebe: Finally I'm not alone anymore in repeating this over and over again:…
Jonas Maebe wrote 5 lines
Hello, Finally I'm not alone anymore in repeating this over and over again: http://twitter.com/kylix_rd/statuses/48210052770836480

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

Martin

Reply by email

Jonas Maebe
to Martin Schreiber
Martin Schreiber wrote 5 lines
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 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

Reply by email