Constref

From Free Pascal wiki
Revision as of 03:29, 24 July 2016 by FPC user (talk | contribs) (Create)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Version 2.6 of Free Pascal added the constref parameter qualifier. It is like a combination of the var and const parameter qualifiers. The argument is passed by reference, but cannot be modified. If you do try and modify the parameter, the compiler will flag it as an error: " Error: Can't assign values to const variable". The new feature notes for version 2.6 suggest that you should only use this for interfacing with external routines in other languages, where this type of parameter passing is required.