[fpc-devel] ref count issue with out param
florian at freepascal.org
Sat Jun 13 20:55:56 CEST 2015
Am 13.06.2015 um 20:08 schrieb Martin Frb:
> On 13/06/2015 17:48, Florian Klämpfl wrote:
>> Am 13.06.2015 um 16:42 schrieb Martin Frb:
>>> On 13/06/2015 15:18, Florian Klämpfl wrote:
>>>> a1, a2 being dyn. arrays, but sharing data, i and j having the same value.
>>> I dug out my old "turbo delphi".
>>> In all both cases (my original example / you dyn array example) Delphi passes nil for the normal
>>> parameter, and fpc passes a dangling pointer.
>> This depends on the order in which parameters are loaded
> I did all my tests with both orders
It is a decision of the code generator, the order of the parameters in the declaration does not matter.
> 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.
More information about the fpc-devel