Hello, reading the RTL unit BaseUnix, I have seen that the function fpFD_ISSET takes its second parameter as a const array:
function fpFD_ISSET(fdno: cint; const nset: TFDSet): cint;TFDSet is a fixed array of 256 bytes. I'm a beginner with free pascal, so at first I guessed that passing a const parameter was like passing a VAR parameter (that is, by address) but the compiler wouldn't allow to change it. But the language reference documentation says:
Remark: Contrary to Delphi, no assumptions should be made about how const parameters are passed to the underlying routine. In particular, the assumption that parameters with large size are passed by reference is not correct. For this the constref parameter type should be used, which is available as of version 2.5.1 of the compiler.
If this is so, that function should be changed to take a pointer to the array or VAR parameter, because if not, a copy of the array is made every time the function is called.
My question is: is this function correct and the array is passed by reference (not copying) when the parameter is a const array? Or on the contrary the array is copied (in which case I think the function should be changed because as it is will be very inefficient)?
Thank you very much,