[fpc-devel] Question on constref

Hairy Pixels genericptr at gmail.com
Thu Feb 2 10:10:40 CET 2023



> On Feb 2, 2023, at 3:57 PM, Adriaan van Os via fpc-devel <fpc-devel at lists.freepascal.org> wrote:
> 
> - under what circumstances (and in what compiler mode) does FPC pass large (say 1 MB or 1 GB) "const" parameters by value (which is extremely inefficient) ?
> - for what reasons ?
> 
> As long as these questions are not addressed and cleared and documented "const" parameters are not a useable in actual code.

That’s what I want to know. There should be a hard rule like records over X bytes are passed by reference. In the issue you posted they said they had a massive performance penalty in their library because const was passing by value and this makes people like myself paranoid so I’m inclined to use constref everywhere with larger records.

Regards,
Ryan Joseph



More information about the fpc-devel mailing list