Am 01.02.2023 um 15:40 schrieb Hairy Pixels via fpc-devel:
On Feb 1, 2023, at 8:27 PM, Michael Van Canneyt via fpc-devel
<fpc-devel@lists.freepascal.org> wrote:
That's exactly what Adriaan is saying. With const the compiler can choose.
With constref, you force it not to copy. But this is not so efficient for
small parameter sizes.
So const will always pass records that are over a certain size by references?
That’s good to know since “const” is more pleasant to look at it than constref.
:)
Which types are passed by-value or by-reference when using const is
determined by the size of the record and the types of the fields based
on whatever the corresponding ABI defines (e.g. the x86_64 Sys V ABI is
rather explicit about some field combinations). The compiler will
however not switch between passing a specific type once by-value and
another time by-reference.
Regards,
Sven
_______________________________________________
fpc-devel maillist - fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel