[fpc-devel] Redefine FillChar() to use out parameter instead

Alexander Klenin klenin at gmail.com
Thu Nov 19 11:42:41 CET 2009


On Thu, Nov 19, 2009 at 20:31, Jonas Maebe <jonas.maebe at elis.ugent.be> wrote:
>
> On 19 Nov 2009, at 11:21, Alexander Klenin wrote:
>
>> On Thu, Nov 19, 2009 at 19:20, Martin <lazarus at mfriebe.de> wrote:
>>
>>> Jonas Maebe wrote:
>>
>> [skipped example]
>>
>>> Well in this case, the code is actually positively affected by the "out"
>>> param (because it avoids the mem leak)
>>
>> Jonas, can you confirm that your example is incorrect one,
>> and Martin's example below is actually what you meant?
>
> Why do you think my example is incorrect? It currently runs without a memory
> leak, and would result in a memory leak if the semantics of "out" would be
> changed from "parameters are automatically finalized at the caller side"
> into "no finalization is performed".

I think that nobody argued against the semantics of "out" parameters --
IMHO the current semantics is good.

> You did ask for an example where changing the semantics of "out" would
> change the behaviour of existing code, didn't you?

No, I asked for an example of code that would be negatively affected by
changing "var" to "out" in FillChar parameter.

-- 
Alexander S. Klenin



More information about the fpc-devel mailing list