[fpc-devel] Capturing addresses
jonas at freepascal.org
Sun Nov 10 15:05:47 CET 2019
On 10/11/2019 14:58, Martin Frb wrote:
> So I am trying to understand what the difference (in terms of safety)
> is? (except that the none "var param" is always unsafe, the "var param"
> is only sometimes unsafe)?
If you are talking about the safety of accesses after the capturing
routine has exited, then that is indeed the only difference.
> Also out of interest, what would change if you ...
>> teach the compiler to be able to assume that addresses
>> of variables are not captured merely because they are passed by
It should allow the compiler to get rid of a lot of temporary function
results (and copying those temporary results to their final
destination), in particular for shortstring and set operations, and for
overloaded operators that work with records.
More information about the fpc-devel