This is indicated in the docs:
Constant parameters can be passed to the function by value or by reference, depending on the particular compiler used. To force the compiler to pass a constant parameter by reference, you can use the [Ref] decorator with the const keyword.
See Constants
When or why does the IDE decide to insert this?
The IDE never inserts this. It simply copies the declaration of the event handler. The one who wrote the event handler places the pass on the [ref] marker.
Does this have any effect in the VCL application?
Yes.
If you mark the 8-byte parameter as const, it will usually be passed by value in x64 and passed by reference in x86.
Declaring it as const [ref] will force it to pass by reference in both cases.
This is very useful when running inline assembly and multi-threaded code.
Before entering const [ref] we were forced to use var instead of const to achieve the same effect.
source share