[fpc-devel] ref count issue with out param

Florian Klämpfl florian at freepascal.org
Sat Jun 13 22:04:41 CEST 2015

Am 13.06.2015 um 21:04 schrieb Martin Frb:
> On 13/06/2015 19:55, Florian Klämpfl wrote:
>>> procedure Foo1(a: AnsiString; out b: AnsiString);
>>> procedure Foo2(out a: AnsiString; b: AnsiString);
>>> So in Delphi it does not depend on this order. The "none out" is always nil.
>> Yes. Implementation specific behavior.
> Really. Then Delphi documented that this (can) break ref counting?

No idea. But not every border case needs to be documented. But I could imagine that it is possible
to construct a case which breaks with delphi as well. Possible candidate:

procedure Foo2(out a: AnsiString; b: AnsiString);cdecl;

Or is it documented somewhere that out parameters are finalized first and then the other parameters
are loaded?

More information about the fpc-devel mailing list