[fpc-devel] Question on constref

Adriaan van Os adriaan at adriaan.biz
Wed Feb 1 11:56:01 CET 2023


Bart via fpc-devel wrote:

> "Note that in general, it should only be used for interfacing with
> external code or when writing assembler routines."

That is wrong. It should read

"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."

In your case, constref is the right choice, although const would be fine also (as your 
datastructure is larger than a small number of bytes).

Regards,

Adriaan van Os



More information about the fpc-devel mailing list