Michael Van Canneyt wrote:
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.

I think it is guaranteed that it will be passed by reference because it is a big structure (at least 16 bytes). Nothing to do with the const.

Perhaps D5 documentation is more clean and clear:

"Variable (var) parameters are always passed by reference, as 32-bit pointers that point to the actual storage location.

Value and constant (const) parameters are passed by value or by reference, *depending on the type and size* of the parameter:"

"Sets, records, and static arrays of 1, 2, or 4 bytes are passed as 8-bit, 16-bit, and 32-bit values. Larger sets, records, and static arrays are passed as 32-bit pointers to the value. An exception to this rule is that records are always passed directly on the stack under the cdecl, stdcall, and safecall conventions; the size of a record passed this way is rounded upward to the nearest double-word boundary."

I am not sure how to interprete this. I think we really need some compiler guys...

Felipe

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

Reply via email to