[fpc-devel] Managed Types, Undefined Bhaviour

Jonas Maebe jonas at freepascal.org
Fri Jun 29 18:27:26 CEST 2018

On 29/06/18 17:57, Stefan Glienke wrote:
> Now we are back to using temp variables (both Delphi and FPC do) but FPC again reuses its temp variable for A and B while Delphi uses different ones. Now for some integer this might not be a big issue but imagine you have something else in these arrays (for example any managed type like an interface).
> Not having properly cleared B because it still uses the temporary content from A might cause some issues.

My point was that Delphi sometimes also reuses temp variables. See the 
StackOverflow posts linked from the previous message. It does not do it 
in the same cases as FPC, but it does do it. So while you may be lucky 
more often in Delphi, relying on this behaviour is unsafe even there afaik.


More information about the fpc-devel mailing list