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
>> reference 

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.


Jonas
_______________________________________________
fpc-devel maillist  -  [email protected]
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply via email to