On Thu, 8 Dec 2005, Felipe Monteiro de Carvalho wrote:

> Michael Van Canneyt wrote:
> > No.
> > 
> > Adding 'Const' does NOT automatically imply passing it by reference.
> > 
> > This used to be so in the initial versions of the compiler,
> > but has been changed quite a while ago.
> 
> But TRect is a structure. Everything I read from Delphi documentation states
> that calling conventions always pass the variable by reference if it is a
> structure. How can a TRect not be passed by reference? Would the compiler try
> to PUSH 4 integer-size variables to the stack? I think this is almost
> impossible to happen.
> 
> Also the Delphi (5) declaration of the functions has const keyword.

Maybe, but nowhere in the Delphi 7 documentation it is stated that const 
implies passing by reference. It MAY happen, but it's not guaranteed.

>From the Delpi 7 docs:

'Constant parameters are similar to value parameters'

'Using Const allows the compiler to optimize code for structured- and 
string-type'

a value parameter is not passed by reference.

Anyway, I'm not a compiler guy, Peter or Florian or Jonas should be answering 
this.

Michael.

_________________________________________________________________
     To unsubscribe: mail [EMAIL PROTECTED] with
                "unsubscribe" as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to