[fpc-devel] Question on constref
Hairy Pixels
genericptr at gmail.com
Wed Feb 1 14:24:41 CET 2023
> On Feb 1, 2023, at 8:16 PM, Adriaan van Os via fpc-devel <fpc-devel at lists.freepascal.org> wrote:
>
> Because, if e.g. the byte-size of a parameter is such that it fits into a CPU register, then passing the parameter itself is more efficient than passing a reference to it. For large byte-size parameters, const and constref function the same. The difference is with small byte-size parameters.
Hmmm I was told otherwise by one of the compiler devs and that I should use constref if I want to guarantee it will not be copied. Maybe one of them can confirm this….
I tried to use https://godbolt.org/ but my program doesn’t seem to be producing any output...
Regards,
Ryan Joseph
More information about the fpc-devel
mailing list