> On Feb 1, 2023, at 5:56 PM, Adriaan van Os via fpc-devel 
> <fpc-devel@lists.freepascal.org> wrote:
> 
> "A const parameter is be passed by reference or (for small-sized parameters) 
> by value, whatever is most efficient. A constref parameter is guaranteed to 
> be passed by reference in all cases. The latter is therefore typically used 
> for interfacing with external code or when writing assembler routines."

I’ve been confused by constref versus const. I use constref when passing large 
records as parameters so I know it will not make needless copies but why 
doesn’t const function this way too? If the parameter is constant why would it 
ever make sense for the compiler to copy the entire record when it knows the 
function can’t change it?

Regards,
Ryan Joseph

_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply via email to